Displaying articles with tag

Setting EXIF dates with a loop

Posted by hank, Tue Sep 18 00: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: