Created
December 8, 2014 11:29
-
-
Save h4/2b4b45f40af1bd7e35ff to your computer and use it in GitHub Desktop.
rename script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
prefix = 'landing__' | |
def visit(a, dir, files): | |
dirname = os.path.abspath(dir) | |
for fname in files: | |
oldname = os.path.join(dirname, fname) | |
if os.path.isdir(oldname): | |
return | |
newname = os.path.join(dirname, '{}{}'.format(prefix, fname)) | |
# print newname | |
os.rename(os.path.join(dirname, fname), newname) | |
os.path.walk('./img', visit, None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment