-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rename_beta.py
38 lines (34 loc) · 1.16 KB
/
Rename_beta.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
print("RENAME HELPS CHANGE SAME NAMES OR EXTENSIONS OF MULTIPLE FILES AT ONCE")
while True:
print("TYPE 'Y' TO MOVE TO THE NEXT FOLDER OR 'N' TO STOP AT THAT FOLDER")
rootPath = "C:/Users"
os.chdir(rootPath)
print(rootPath)
do = input("Do you want to go further: ").upper()
while do == "Y":
lis = os.listdir(rootPath)
n = 1
for x in lis:
print(n, "-", x)
n += 1
k = int(input("What number of file do you want to enter: "))
r = k-1
add = str(lis[r])
if "." in add:
print("Sorry, Can't go any further")
exit()
else:
newPath = rootPath + "/" + add
print(newPath)
os.chdir(newPath)
print(os.listdir(newPath))
rootPath = newPath
do = input("Do you still want to go further: ")
print(rootPath)
nlist = os.listdir(rootPath)
old = input("What do you want to change: ")
new = input("To what: ")
for n in nlist:
os.rename(n, n.replace(old, new))
print("YOUR OPERATION HAS BEEN COMPLETED\nCHECK YOUR FOLDER")