« Planes, Trains And Automobiles | Main | Picture Postcards »

Catching Up With Time

I'd forgotten to change the time on my digital camera from PDT to CEST, so all of the photos I've taken since getting here have timestamps and EXIF headers that are nine hours off. Rather than live with this, I quickly cooked up the following one-liner to rectify matters:

 for i in *.jpg; do cp $i /tmp; jhead -ta+9:00 /tmp/$i; \
 time=$(ruby -e "puts Time.at("$(($(stat -c '%Y' $i)+9*60*60))")"); touch -d "$time" /tmp/$i; done

There's got to be a better way, though, right? I mean, it would be nice to feed the output from stat right back into touch's -d option without having to use Ruby to convert it to a human-readable string. Note that the file must be touched after one has modified its EXIF header, not before, because modifying the header also resets the modification timestamp.

Anyway, at 03:00, this is the best I can manage and it gets the job done.

TrackBack

TrackBack URL for this entry:
http://www.caliban.org/cgi-bin/mt/mt-tb.cgi/230

Post a comment


About

This page contains a single entry from the blog posted on Friday, 9 September 2005 at 03:24:55.

The previous post in this blog was Planes, Trains And Automobiles.

The next post in this blog is Picture Postcards.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34