Friday, 10 April 2015

Fix incorrect file date/time and EXIF data on images from digicam

I noticed about 2 months late that the data on my digital camera was off by many years. As I use the file's last modification time to rename all images and videos to include the date in the file name, this was very impractical, and very annoying. The following fixed it all.

Run this in each directory with files with the incorrect date and time. Obviously you need to change the number of days, hours and minutes, and whether you add or subtract them. And make sure all the files in the directory have the file and EXIF date off by the same amount of time.
for f in *; do touch -d "$(date -r $f) + 883 days - 3 hours + 5 minutes" $f; done
for f in *.JPG; do jhead -dsft $f; done

The first one changes the files' last modification time. This obviously works for all types of files.
The last one uses the file modification time to update the EXIF header of all JPEG files.

1 comment:

  1. Merkur 15c Safety Razor - Barber Pole - Deccasino
    Merkur 15C Safety Razor - Merkur - 15C for Barber Pole is the perfect introduction to the Merkur Safety 바카라 사이트 Razor. kadangpintar