Wednesday, May 16, 2007

Magic Bucket - part 001

I've got ActiveState Python installed on my laptop and work machines. I took about 35 minutes on the train today to write this little program.

import datetime,os

thisdate =
foldername = "c:\photos\source\%04d\%04d%02d%02d" % (thisdate.year,thisdate.year,thisdate.month,
try: os.makedirs(foldername)
except WindowsError, e:
print e.strerror
if e.winerror <> 183:

os.system("explorer "+foldername)

I'll comment it up and add some more logic later, but the gist of it is that it automates the creation and opening of a folder which I do when I transfer photos. It'll save about 30 seconds each time it's run.

One small set on a long journey.


PS: I used a variant of this code to colorize/HTML the code.

No comments: