# Shifting Time Stamps on Photos

A useful tip for when your camera’s time settings were off…

Using the great program exiftool you can easily shift the time stamps if your camera’s date and time were off when you took them. I have a Sony NEX-3N, so there are some tags specific to this camera, but in general you can run code like the following, which will shift the timestamps of all files in the current directory back two hours:

exiftool -alldates-=2 -IFD1:ModifyDate-=2 -SonyDateTime-=2 .


After you run this, you can also use the following code to rename and set the file access times to those contained in the actual EXIF data of the images (lifted from here). You might have to run this with both '*.JPG' and '*.ARW' in the appropriate places if you have both JPEG+RAW files:

find -name '*.JPG' | while read PIC; do
DATE=$(exiftool -p '$DateTimeOriginal' $PIC | sed 's/[: ]//g') touch -t$(echo $DATE | sed 's/$..$/\.\1/')$PIC
mv -i $PIC$(dirname $PIC)/$DATE.JPG
done


Note: you can also use a tool like GPicSync to add GPS data to the photos

Previous
Next