Photo Notes

Dec 20, 2011 Published by Tony Primerano

I have 1000s of pictures that I have been organizing, renaming and changing the dates (exif) on.

Seems each time I do this i forget where I put the pictures and what program I used to rename or edit.


jhead to the rescue

  • If the exif data is has the correct date but the modified time on the file is wrong use jhead -ft *.jpg to change the time on the file.
  • to make filenames have the date from exif use jhead -n%Y%m%d-%H%M%S *.jpg
  • Adjust time with jhead -ta. Example. If you took a picture in 2002 but your camera was set to 2003 you can move it back 2 year with. jhead -ta-8760 -ft test.jpg
    • Note -ft is so the modified time will move back also
    • 8760 is the number of hours in a year
    • if going over a leap year use 24 more. For example. I moved files with 2007 dates to 2008 (taken after February)
      • jhead -ta+8784 -ft *JPG

My approach

  • leave file names alone and set the file date to the exif setting
    • jhead -ft *.jpg
  • See if any images are out of order when you ls -ltrthem
    • Adjust dates as necessary with jhead -ta option
  • Once your convinced all the exif data is correct rename all files by date.
    • jhead -n%Y%m%d-%H%M%S *.jpg

What about my movie files?

jhead won't help you here but you can use touch (unix/linux) to correct the dates on these files. Ex. I know these 2 AVIs are an hour ahead

  • ls -l --time-style=full-iso *avi
    • 2007-11-04 14:06:44.000000000 -0500 MVI_0396.avi
    • 2007-11-04 15:03:13.000000000 -0500 MVI_0426.avi

Lets move them back an hour. manually typing in the date

  • touch -t 200711041306.44 MVI_0396.avi
  • touch -t 200711041403.13 MVI_0426.avi
  • ls -l --time-style=full-iso *avi
    • 2007-11-04 13:06:44.000000000 -0500 MVI_0396.avi
    • 2007-11-04 14:03:13.000000000 -0500 MVI_0426.avi

yay. the dates are now correct

  • 2001 folder -- 126 pics.
  • 2002 folder -- 424 pics.
  • 2003 folder -- 516 pics
  • 2004 folder. -- 910 pics
  • 2005 folder -- in progress - 1652 pics