Dates from filenames and sequence

Started by peterlappo, January 04, 2023, 05:07:28 AM

Previous topic - Next topic

peterlappo

hi
Just a note to say thanks for a brilliant tool.

And this is how I recreated timestamps for 3 thousand scanned images with yyyy-mm-<some other text> using Mac OSX. I have no idea how long it would have taken to do this manually but the script took 4 hours to run. I also changed GPS data at the same time.

Not real coordinates but all parameters were required for lightroom to figure out the location. But didn't need quoting with '' as there were no spaces or shell variables involved.


exif_param1_1='-AllDates<${filename;$_=/(\d{4}-\d{2})/ ? $1 : undef}-01 12:00:$filesequence'
exif_param1_4='-GPSLatitude=10.1 -GPSLongitude=-10.13947 -GPSLatitudeRef=N -GPSLongitudeRef=W -GPSAltitudeRef=0 -GPSAltitude=20'
exif_param1_5='-FileModifyDate<${filename;$_=/(\d{4}-\d{2})/ ? $1 : undef}-01 12:00:$filesequence'
exif_param1_6='-FileCreateDate<${filename;$_=/(\d{4}-\d{2})/ ? $1 : undef}-01 12:00:$filesequence'
exif_args1="-P -overwrite_original -FileOrder Filename"

exiftool ${exif_args1} \'${exif_param1_1}\'  $exif_param1_4 \'${exif_param1_5}\' \'${exif_param1_6}\' *.tif
There may have been a better way to extract the year and month but the patterns worked for me.


Many thanks
Peter

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).