My uncle came over with a CD of photos from his trip to Peru. I am pretty sure the CD was created with iPhoto as there was an iphoto.xml file in the root of it. Anyways the first problem I had was viewing the pictures after mounting the CD. The file sizes were all weird (too small considering the camera that was used to take them) and some file names were duplicated. Trying to open them up with kuickshow or imagemagick did not work. Then I remembered that this happened before when we got our photos from our wedding photographer (also a Mac user). The solution is to not use the "auto" filesystem type, but to use "iso9660" instead. I forgot to check what the "mount" command actually said it had mounted it as, but mounting it manually from the command line with the "-t iso9660" option fixed it (my fstab has "auto" for the cdrom filesystem type). After fixing that, the filenames of all the photos were unique and the file sizes seemed more reasonable (~2.5 MB).
The second problem was that the photos were not stored in a flat hierarchy in one single directory, there were stored in the year/month/day directory hierarchy. kuickshow, an excellent image viewer/slideshow program, did not want to handle these directories recursively. So I had to whip up a quick python script. I knew I probably could have done it in bash too. But I don't know bash and it's not as readable. Relies too much on special punctuation to do things, kind of like perl. I hate the [-e and [-n kind of stuff, and the dollar signs. So ugly. Here's the quick script:
from os.path import getsize
for root, dirs, files in os.walk(dir):
for file in files:
if getsize(fullpath) > 200000:
It worked great. Pythonistas will not be too impressed by this 10-liner. I'm mainly just showing that for those who have never used Python or those who have only used Python a little. It makes a great bash replacement, better than Perl because you can read it again later and actually understand it. I have used for many other such tasks, most of them more complicated than this one.
getsize(fullpath)>200000 was to filter out the thumbnails which iPhoto also included on the CD. The fact that it included thumbnails is the dumbest thing in the world by the way. If you are exporting files on a CD one would expect that the person who exported it was going to give the CD to someone else and that someone else might not have iPhoto, so the thumbnails become totally useless. In my opinion, thumbnails are something should be filed away in a hidden cache directory on the user's hard drive, and not seen anywhere else. GIMP used to put thumbs in a .xvpics folder, something else uses ThumbsDB (Windows?). Picasa (correctly) puts them somewhere where I can't see them.
The only other problem was that stupid iPhoto had duplicated some photos so they appeared twice. I realized afterwards that some folders had a thumbs directory and an originals directory, and some originals in the the directory itself. This might have been because there were modifications to the original so the originals were copied automatically to a sub-folder before being modified.