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)+96060))”)”); 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.