Here's the script:
import os
from PIL import Image
import shutil
cdate_tag = 0x9003
files = [f for f in os.listdir('.') if f.endswith('.JPG')]
for f in files:
if os.path.isfile(f):
img = Image.open(f)
date = img._getexif()[0x9003].split(' ')[0].replace(':','_')
if not os.path.isdir(date):
os.mkdir(date)
shutil.move(f,os.path.join(date,f))
print f,date
img.fp.close()
No comments:
Post a Comment