{"id":617,"date":"2009-04-20T23:17:01","date_gmt":"2009-04-21T03:17:01","guid":{"rendered":"http:\/\/www.dr-chuck.com\/wordpress\/?p=617"},"modified":"2011-12-17T12:30:23","modified_gmt":"2011-12-17T16:30:23","slug":"organizing-files-on-a-memory-sticksd-for-a-photo-frame","status":"publish","type":"post","link":"https:\/\/www.dr-chuck.com\/csev-blog\/2009\/04\/organizing-files-on-a-memory-sticksd-for-a-photo-frame\/","title":{"rendered":"Organizing files on a Memory Stick\/SD for a Photo Frame"},"content":{"rendered":"<p>\nI 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.<\/p>\n<p>\nI 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&#8230; screen and then gave up and only showed files from the internal memory &#8211; not the SD card.<\/p>\n<p>\nSo 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.<\/p>\n<p><pre>\nimport os\nfor i in range(10):\ntry: os.mkdir(\"dir\"+str(i))\nexcept: pass\nfor j in range(10):\ntry: os.mkdir(\"dir\"+str(i)+\"\/dir\"+str(j))\nexcept: pass\ni = 0\nj = 0\nfor root, dirs, files in os.walk('.'):\nfor file in files:\nif file.startswith(\".\") :\ntry: os.unlink(file)\nexcept: pass\ncontinue\nif not ( file.endswith('.jpg') or file.endswith('.JPG') )  : continue\nplace = \"dir\"+str(i)+\"\/dir\"+str(j)+\"\/\"+file\nj = j + 1\nif j > 9 :\ni = i + 1\nj = 0\nif i > 9 : i = 0\nprint file, place\nos.rename(file,place)\n<\/pre>\n<p>\nAnd it worked &#8211; a cheap closeout photo frame ($20.00 from Aldi&#8217;s) with a $14 8GB SD card and I have 9 years of photos showing randomly!  Yay!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-617","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/comments?post=617"}],"version-history":[{"count":1,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/617\/revisions"}],"predecessor-version":[{"id":2726,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/posts\/617\/revisions\/2726"}],"wp:attachment":[{"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/media?parent=617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/categories?post=617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dr-chuck.com\/csev-blog\/wp-json\/wp\/v2\/tags?post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}