When I was home over the weekend, I was working on helping my parents sort out the photos they took while they were in Europe. Doing this, I noticed that the date on the camera was out by a month. Being a stickler for correct metadata, I tried to figure out a way to fix this. This is the command line that I came up with. I’ve broken it into multiple lines here for clarity.
for f in *.jpg ; do
NEWDATE=`exiftool -CreateDate $f |
perl -pe 's/.*: 2006:([^:]+):/sprintf "2006:%02d:", ($1+1)/e'`;
echo $f: $NEWDATE;
exiftool -CreateDate="$NEWDATE" -DateTimeOriginal="$NEWDATE" $f;
done
This will modify the month field in the EXIF data of each file by increasing it by 1. It doesn’t handle wrap around or anything, I didn’t need to do that. The fanciest it gets is making sure there’s the correct number of zeros padding the number.
You don’t want to run this twice.