Setting EXIF dates with a loop

Posted by hank, Mon Sep 17 20:11:00 UTC 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.

Tags:

Comments

  • no avatar available for trpik trpik
    September 18, 2007 @ 10:42 PM

    I READ YOUR BLOG TOO….. not really.

  • photo of trpik trpik
    September 18, 2007 @ 10:43 PM

    NOOOOOO !

Have your say

A name is required. You may use Markdown in your comments.