Selecting the tools

Yesterday, it was time to keep up with an abandoned project. I have an automatic python script that arranges photos in folders by date.

# -*- coding: utf-8 -*-

from PIL import Image
import os
import shutil

# exists src_dir/hoge.jpg, fuga.png, etc...
src_dir = "/Users/name/hoge/"
# create dst_dir/yyyymmdd/
dst_dir = "/Users/name/fuga/"

if os.path.exists(dst_dir) == False:

for root, dirs, files in os.walk(src_dir):
for filename in files:
image =, filename))
# 36867 : EXIF DateTimeOriginal
date = image._getexif()[36867]
yyyy, mm, dd = date[:4], date[5:7], date[8:10]
yyyymmdd_dir = os.path.join(dst_dir, str(yyyy) + str(mm) + str(dd))
if os.path.exists(yyyymmdd_dir) == False:
dst = os.path.join(yyyymmdd_dir, filename)
if os.path.exists(dst) == False:
shutil.copy2(os.path.join(root,filename), dst)
except Exception as e:
# .DS_Store must Die
print filename + ' is fail.'

I wanted to make a GUI for it. I was thinking of a transition to openFrameworks since it will have straightforward image display and I know how to detect keystrokes there. Plus, I will be able to create an executable to share it with my friends.

But it’s time to learn some things about Tkinter and how to detect keys in Python. And it’s definitely time to built a Windows app with python and tkinter. I’ll stick with Python for now and see how that goes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s