Created
July 29, 2017 18:51
-
-
Save ynonp/ffbdc335da13b4c9a71070e6c1cef7e1 to your computer and use it in GitHub Desktop.
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 sys | |
import os | |
if len(sys.argv) != 3: | |
print "Usage: %s <oldsuffix> <newsuffix>" % sys.argv[0] | |
sys.exit(1) | |
(_, oldsuffix,newsuffix) = sys.argv | |
for name in os.listdir("."): | |
if name.endswith(".%s" % oldsuffix): | |
newname = name[:-len(suffix)] + newsuffix | |
print "Renaming %s => %s" % (name,newname) | |
os.rename(name,newname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment