I have looked at the code here and it doesn't look that hard.
Can't resolve WindowsError: [Error 2] The system cannot find the file specified
However, it doesn't work in my case. I quite new to Python here. I am renaming the folders instead of the files. Then each of these folders have some files that need to be renamed too.
Here is what I have so far in renaming the folders in a directory:
import os
from os import rename, listdir
path = r"E:\myFolder"
dirList = os.listdir(path)
print str(dirList)
for name in dirList:
nameOrig = (name[0:(len(name)-12)])
nameRename = nameOrig + "City"
os.rename((os.path.join(path, nameOrig), os.path.join(path, nameRename))
Thanks very much