added code to rename the files
This commit is contained in:
parent
49999b872b
commit
59a0bbd4b8
19
renaming.py
Normal file
19
renaming.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import sys, os
|
||||||
|
import re
|
||||||
|
|
||||||
|
folder_path = "static/files/"
|
||||||
|
olds = "'"
|
||||||
|
new = ""
|
||||||
|
|
||||||
|
def replace(folder_path, old, new):
|
||||||
|
for path, subdirs, files in os.walk(folder_path):
|
||||||
|
for name in files:
|
||||||
|
for old in olds:
|
||||||
|
if(old.lower() in name.lower()):
|
||||||
|
file_path = os.path.join(path,name)
|
||||||
|
name = name.lower().replace(old,new)
|
||||||
|
new_name = os.path.join(path,name)
|
||||||
|
print(new_name)
|
||||||
|
os.rename(file_path, new_name)
|
||||||
|
|
||||||
|
replace(folder_path, olds, new)
|
Loading…
Reference in New Issue
Block a user