Skip to content

Sorted!

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[2].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.

4 thoughts on “Sorted!”

  1. This is great, but how do I start the script? How do I open it and perform all the arrangements?

    I am using Windows 7 and Windows XP…

    Thanks a lot

  2. This is great, but how do I start the script? How do I open it and perform all the arrangements?

    I am using Windows 7 and Windows XP…

    Thanks a lot

  3. Hi joepres,

    Sorry for the delay – just got around to logging back in and reviewing the comments today.

    If you have Perl installed then you just need to do a few more little things. First download jhead from the link in the post above. Place it in a folder that is on your system path or alternatively add the folder you put jhead in, to your system path.

    Once you have done that then it’s just a matter of running the script

    e.g. exifsort.pl c:photos-to-be-sorted

    The exifsort.pl script contains a variable that specifies the output directory for your renamed/sorted files, it’s called $targetpath and is at the top of the exifsort.pl file. You can edit it in a text editor and specify your own directory.

    That’s all you need to do to get the basic sort working. To do more advanced things and make customised renaming of files happen, you’ll need to do a little more investigation but this should get you up and running.

    Sorry again for the delay in responding.

  4. Hi joepres,

    Sorry for the delay – just got around to logging back in and reviewing the comments today.

    If you have Perl installed then you just need to do a few more little things. First download jhead from the link in the post above. Place it in a folder that is on your system path or alternatively add the folder you put jhead in, to your system path.

    Once you have done that then it’s just a matter of running the script

    e.g. exifsort.pl c:photos-to-be-sorted

    The exifsort.pl script contains a variable that specifies the output directory for your renamed/sorted files, it’s called $targetpath and is at the top of the exifsort.pl file. You can edit it in a text editor and specify your own directory.

    That’s all you need to do to get the basic sort working. To do more advanced things and make customised renaming of files happen, you’ll need to do a little more investigation but this should get you up and running.

    Sorry again for the delay in responding.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.