This weekend I decided to settle down to a task that I have been putting off for a long time now. That task was the organisation of my digital photo library, spread across 3 different computers and a network storage drive. Over the years I have used so many different digital cameras, software packages for organising photos, etc that my digital library was in somewhat of a mess. Using exif data to sort files based on chronological data is obviously the way to go and there are several utilities out there for a small fee that will do this for you. However, I was feeling a little frugal and initially had a crack at parsing the exif data myself using some c# knowledge. It was reasonably successful but too many variables involved in doing it properly. So, I then decided that I didn’t have the time to write a full utility and went looking for freebies. What I found was truly wonderful. A short Perl script that uses jhead to extract exif data from jpg files and then sorts the files into year/month directories and renames all the files to yearmonthdate_time.jpg format. Better again is that the clever script performs a MD5 hash on any file with exactly the same date and time to see if indeed it is the same file, if so it skips the duplicate, if not it copies it as a filename.jpg to indicate the legal duplicate. Granted it still took a while to parse through everything but my task was made infinitely simpler by using this little script. Now I have a digital library to almost be proud of. Almost because I have a quantity of files that are not exif timestamped and need to be sorted manually at a later date.
Note: While this utility is great for parsing jpg files, I couldn’t get jhead to parse the exif information from RAW format files. That added a little bit of time to my task but not too much.