File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 13
13
if (n == "y" or n == "Y" or n == "p" ):
14
14
rename ,hidden = 0 ,0
15
15
for i in range (len (files )- 1 ):
16
+
17
+ oldname = files [i ]
18
+
16
19
if (files [i ][0 ]== "." ):
17
20
hidden += 1
18
21
continue
22
25
isNum = files [index - 1 ]
23
26
24
27
if (isNum >= "0" and isNum <= "9" ):
25
- oldName = files [i ][index + 1 :]
28
+ tempOld = files [i ][index + 1 :]
26
29
else :
27
- oldName = files [i ]
30
+ tempOld = files [i ]
28
31
else :
29
- oldName = files [i ]
32
+ tempOld = files [i ]
30
33
31
34
rename += 1
32
- newfile_name = f"{ str (rename ).zfill (digits )} _{ oldName } "
35
+ newfile_name = f"{ str (rename ).zfill (digits )} _{ tempOld } "
33
36
34
37
if (n == "p" ):
35
- print (f"{ oldName } --> { newfile_name } " )
38
+ print (f"{ tempOld } --> { newfile_name } " )
36
39
else :
37
- os .rename (oldName ,newfile_name )
38
- print ( "File renaming successful. \n " )
40
+ os .rename (oldname ,newfile_name )
41
+
39
42
print (f"\n Number of hidden files are { hidden } . For safety purpose, they will be kept unchanged." )
40
43
41
44
else :
42
- print ("File renaming cancel." )
43
- exit (0 )
45
+ print ("File renaming cancel." )
46
+ exit (0 )
47
+
48
+ if n == "y" or n == "Y" :
49
+ print ("\n File renaming successful." )
You can’t perform that action at this time.
0 commit comments