From: Robert Peirce on
Tifs from scans and possibly other images don't show a capture date,
which is the common way I keep track of things.

I store my images by date in a directory tree -- yyyy/mm/dd/image and I
want the capture date to exist and to match the directory. That's fine
with jpg and various RAW formats but not for tifs. To get around this I
created a shell script, which Mac, Unix and Linux users can probably use
directly and Windows users with a little fiddling, to call exiftool with
the correct argument. This script changes all the files in a directory.

#!/bin/ksh
# spdf -- set Photo Date for entire directory

if [[ $# -ne 3 ]]
then
print usage: spdf Year Month Day
exit
fi

Year=$1
Month=$2
Day=$3

while (("$Year" < 1977)) # The earliest year in my library
do
printf "Year (YYYY) = "
read Year
done
while (("$Month" > 12 || "$Month" < 1))
do
printf "Month (MM) = "
read Month
done
case $Month in
02) while (("$Day" > 29 || "$Day" < 1))
do
printf "Day (DD) = "
read Day
done;;
01|03|05|07|08|10|12)
while (("$Day" > 31 || "$Day" < 1))
do
printf "Day (DD) = "
read Day
done;;
04|06|09|11)
while (("$Day" > 30 || "$Day" < 1))
do
printf "Day (DD) = "
read Day
done;;
esac

string=$(printf "%4s:%2s:%2s 12:00:00\n" $Year $Month $Day)

exiftool -overwrite_original\
-DateTimeOriginal="$string"\
*