After waiting for the barrier to entry to become feasible for my pocketbook, I finally jumped into the DSLR world by purchasing a new Nikon D5100. Thus far it has been an absolutely wonderful camera and has provided me many photos that I will cherish for many years to come. My first one thousand exposures or so were taken with an incorrect date programmed into my camera. Every bit of date related metadata in my images is off by exactly one year. Looks like I forgot it was 2011 and put 2010 into the settings. I use Aperture to process, organize and edit my photos, but I could find no way to increase the year by one on all of my images.
Enter ExifTool. The amazing perl script that will read and save metadata to almost every digital photo file format known to man.
ExifTool makes it easy to increase the year by one, with this simple command that can be run on an entire Directory, or individual file:
exiftool -AllDates+="1:0:0 00:00:00" DIR (or filename)
Now, I peeked inside my Aperture Library and found the directory called “Masters”, where all Master image files are stored. I ran the following script inside the directory and it took care of business. My semi complicated find command ignores files with spaces, ignores Canon, iPhone and other unwanted files. What I’m left with is my Nikon pictures, which I can then run the exiftool command on.
#!/bin/bash function is2010() { fileName=$1 creationYear=$(exiftool $fileName | grep "Date/Time" | sed 's/^.*: //g' | awk -F":" '{print $1}' | grep 2010) return $? } imageFiles=$(find . -type f ! -name "*(*" ! -name '* *' \( -iname "*.jpg" -or -iname "*.nef" \) ! -iname ".*" ! -iname "IMG_*" ! -name "CSC_*") for f in $(echo $imageFiles) do if ( `is2010 $f` ); then exiftool -AllDates+="1:0:0 00:00:00" $f else echo "skipping $f" fi done |





