Created
March 20, 2014 06:07
-
-
Save daizuozhuo/9658164 to your computer and use it in GitHub Desktop.
python: rename images
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 os | |
import shutil | |
import time | |
dir = raw_input()+"/" | |
if os.path.isdir(dir): | |
print ("Directory is exit") | |
else: | |
print ("Directory is not exit,please input right dir....") | |
time.sleep(5) | |
exit() | |
filelist=[] | |
filelist=os.listdir(dir) | |
#print filelist | |
count=0 | |
for i in filelist: | |
if '.jpg' in i: | |
NewFile=str(count) | |
count=count+1 | |
print NewFile | |
shutil.move(dir+i,dir+NewFile+'b.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment