Organizing files on a Memory Stick/SD for a Photo Frame

I have a cheap photo frame with very little built in memory but it had a SD slot in it so I waited until 8GB SD cards went on sale and bought one.

I exported all my photos from iPhoto in one big drag and drop into a folder. This ended up with about 7000 JPG files in a single directory. When I put this SD card in my photo display simply hung for a long time on the Loading… screen and then gave up and only showed files from the internal memory – not the SD card.

So I wrote a little Python script to spread the files across 10 folders with 10 sub-folders in each folder. Just pushed things around randomly basically hoping the microcode in the photo frame could handle 80 photos per directory. I dropped the Python script in the main folder of the SD card and fired away. I even got rid of some of those Mac metadata files which started with a dot to give my poor photo frame a fighting chance.

import os
for i in range(10):
try: os.mkdir("dir"+str(i))
except: pass
for j in range(10):
try: os.mkdir("dir"+str(i)+"/dir"+str(j))
except: pass
i = 0
j = 0
for root, dirs, files in os.walk('.'):
for file in files:
if file.startswith(".") :
try: os.unlink(file)
except: pass
if not ( file.endswith('.jpg') or file.endswith('.JPG') )  : continue
place = "dir"+str(i)+"/dir"+str(j)+"/"+file
j = j + 1
if j > 9 :
i = i + 1
j = 0
if i > 9 : i = 0
print file, place

And it worked – a cheap closeout photo frame ($20.00 from Aldi’s) with a $14 8GB SD card and I have 9 years of photos showing randomly! Yay!