Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import re
- dir = raw_input("Please enter the path you want to use: ")
- for file in os.listdir(dir):
- if not re.search(r'\d', file):
- continue
- newFilename = ''.join(re.split(r'\d', file)
- os.rename(os.path.join(dir, file), os.path.join(dir, newFilename)
- print "Renamed file %s to %s" % (file, newFilename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement