I wrote a little utility to reorganize my digital camera pics based on the EXIF date-taken data stored in the pic. It’s pretty simple, I hacked it together in about an hour,
but I thought it might be worth sharing for anyone else looking to do something similar. My camera organizes stuff as it sees fit sometimes, I am particular about my directory structure. This is probably a job best left to perl, but I don’t feel like getting Perl running on my Windows box where all the pics are. Now I can finally burn all my images to DVD.
- Drew Noakes’s Metadata Extractor – this is
a required library used to do the actual reading of the exif data. - FileOrganizer.java – Abstract base class that moves
files from a source to a target directory based on criteria specified in the subclass. - JpegFileOrganizer.java – Subclass that
accepts jpeg files and generates the correct path based on the EXIF data stored
in the image’s header. So if picture pic00001.jpg was taken on August 20, 2004, and the supplied
target directory is “/pics”, the directory to which the image would be moved would be
/pics/2004/08/20/pic00001.jpg.
The main()
method is in JpegFileOrganizer, its arguments are [sourceDir] [targetDir].