Conditionally Applying Time Zone Offsets

Started by neebah, December 05, 2020, 08:59:27 AM

Previous topic - Next topic

neebah

I have a bunch of photos that I know were all taken in the same place.  I would like to conditionally go and apply time zone information (Exif:OffsetTimeOriginal, OffsetTimeDigitized) to each file based on when DST occurred in my area (I have a list of all of the dates that this occurred for the files mentioned above).  How would I go about doing that with an if statement in ExifTool?

Phil Harvey

#1
Doing this one at date range at a time could go something like this (I'm pulling date/times out of thin air here):

exiftool -if "$createdate gt '2019:10:01 02:00' and $createdate lt '2020:04:01 02:00'" "-offsettimedigitized=-04:00" DIR

- Phil

Edit: Fixed incorrect quotes.
...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 ($).

neebah

Thank you.  Will give it a try.  Any way of stringing multiples together in the if statement (else if behavior)

Phil Harvey

Sure.  You can do this:

exiftool -if "$createdate gt '2017:10:02 02:00' and $createdate lt '2018:05:01 02:00' or $createdate gt '2018:10:05 02:00' and $createdate lt '2019:04:03 02:00' or $createdate gt '2019:10:01 02:00' and $createdate lt '2020:04:01 02:00'" "-offsettimedigitized=-04:00" DIR

- Phil
...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 ($).

neebah

This did not work.  It set all of the offsettimedigitized to the same value

neebah

Nevermind.  I must've typed something down.  Should've copied and pasted (and modified)