Skip to content

Instantly share code, notes, and snippets.

@daizuozhuo
Created March 20, 2014 06:07
Show Gist options
  • Save daizuozhuo/9658164 to your computer and use it in GitHub Desktop.
Save daizuozhuo/9658164 to your computer and use it in GitHub Desktop.
python: rename images
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