Before Running Script |
After Running Script
|
---|---|
import os loc = 'E:/My Folder/' path = os.path.abspath(loc) i = 1 for file_name in os.listdir(path): new_filename = 'File ' + str(i) + file_name[-4:] old_filename = loc + file_name new_filename = loc + new_filename print 'old: ', old_filename print 'new:', new_filename os.rename(old_filename, new_filename) i += 1 print 'Job Done!'