Being given a DVD of photos, I ran my exifsort script to sort the images into date stamped folders and found the camera that had taken the pictures had the year set to 2026.

I came accross a handy utility to modify the EXIF timestamp of the images called exiv2 at www.exiv2.org. Unfortunately Debians repository is horribly out of date, so I grabbed the source from their site.

I began with a ./configure and came accross this error:

configure: error: either specify a valid expat installation with --with-expat=DIR or disable XMP support with --disable-xmp

It was easily fixed by installing the libexpat1-dev package,

apt-get install libexpat1-dev

Exiv2 compiled nicely after that.

I use 2 digital cameras, and my phone, to take pictures nearly every day. I came accross a perl script written by Lars Strand. This copied photos from CAM0001.JPG to a date formatted file such as 20070113.0900.JPG.

I decided to take this as a base, and change it into something that suited my own needs.

The script will take directories on the command-line and copy any pictures found to a target directory set within the script. It then creates a file and directory structure based on the EXIF time/date found in the JPEG.

For example,

  • /source/CAM0001.JPG

now becomes

  • /target/2007/11.nov/20070113.0900.jpg

.. making the files easy to find and splitting them into months.

The script produces an output such as,

ExifSort v1.0 - http://www.nooblet.org/exifsort/

 o Processing folder, /mnt/storage/Photos/100DSCIM/
 o Processing folder, /mnt/storage/Photos/100CASIO/
    CIMG0553.JPG -> 20071111_145714.jpg
    CIMG0554.JPG -> 20071111_153500.jpg
    CIMG0555.JPG -> 20071111_153529.jpg
    CIMG0556.JPG -> 20071111_153614.jpg
    CIMG0557.JPG -> 20071111_155707.jpg
    CIMG0564.JPG -> 20071111_181839.jpg
    CIMG0567.JPG -> 20071111_182038.jpg
    CIMG0569.JPG -> 20071111_182659.jpg
    CIMG0574.JPG -> 20071111_215006.jpg
    CIMG0575.JPG -> 20071112_120508.jpg
    CIMG0580.JPG -> 20071112_120723.jpg
    CIMG0582.JPG -> 20071112_182803.jpg
 o Processing complete.
    12 files copied.
     - 101 files the same.

The script checks modified dates and file sizes, and will compare the md5 checksum if it still isn’t sure, to know if it has already copied an existing file.

The photos folder in my family photo gallery is a direct result of this exif sorting script.

Requirements:

Download

  exifsort.pl (5.2 KiB, 1,118 hits)