ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: peterlappo on January 04, 2023, 05:07:28 AM

Title: Dates from filenames and sequence
Post by: peterlappo on January 04, 2023, 05:07:28 AM
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
Title: Re: Dates from filenames and sequence
Post by: Phil Harvey on January 04, 2023, 06:48:30 AM
Very good!

- Phil