I use the following code to replace file/folder names in a directory.
old = abc
new = def
for path, subdirs, files in os.walk(folder_path):
for name in files:
if old in name:
file_path = os.path.join(path, name)
new_name = os.path.join(path, name.replace(old, new))
os.rename(file_path, new_name)
This works, however, I have one folder named abc.files
os.walk does not see this folder, how do I fix the code so it changes abc.files
to def.files
?