Created
April 30, 2012 20:46
-
-
Save alexstorer/2562538 to your computer and use it in GitHub Desktop.
copying files and renaming them
This file contains 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 fnmatch | |
import os | |
import shutil | |
import re | |
for file in os.listdir('.'): | |
flist = os.path.basename(file).split('.') | |
fname = flist[0] | |
fext = '.blah' | |
try: | |
newname = str(int(fname)+1289) | |
print fname + " is a tweet!" | |
shutil.move(fname+fext, newname+fext) | |
print "copied to "+newname+fext | |
except Exception: | |
print fname + " is not a tweet." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment