Home > Setting EXIF dates with a loop

Setting EXIF dates with a loop

September 18th, 2007

Magic EXIF recursive tagging!

Have you ever had your files all nicely nested in directories, but needed to change their EXIF dates? Here’s what I used today to do it:


# Structure like this: 1997/08/Picture.Whatever Maybe Some Spaces.jpg

# Delete the EXIF tags (DONT DO THIS UNLESS YOU KNOW WHAT YOU'RE DOING!)
find . -mindepth 3 -exec jhead -de "{}" \;

# Make Fresh EXIF tags
find . -mindepth 3 -exec jhead -mkexif "{}" \;

# Set the dates according to the Year and Month information in the filenames
find . -mindepth 3 | perl -ne '@a = split(/\//, $_); chomp($_); print `jhead -da$a[1]:$a[2]:01-2007:09:17 "$_"`, "\n"'

This worked wonderfully.


, , , , ,

  1. trpik
    September 18th, 2007 at 00:11 | #1

    I READ YOUR BLOG TOO….. not really.

  2. September 18th, 2007 at 00:11 | #2

    NOOOOOO !

  1. No trackbacks yet.
Comments are closed.