ExifTool Forum

General => Metadata => Topic started by: neebah on December 05, 2020, 08:59:27 AM

Title: Conditionally Applying Time Zone Offsets
Post by: neebah on December 05, 2020, 08:59:27 AM
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?
Title: Re: Conditionally Applying Time Zone Offsets
Post by: Phil Harvey on December 05, 2020, 09:29:39 AM
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.
Title: Re: Conditionally Applying Time Zone Offsets
Post by: neebah on December 05, 2020, 09:36:10 AM
Thank you.  Will give it a try.  Any way of stringing multiples together in the if statement (else if behavior)
Title: Re: Conditionally Applying Time Zone Offsets
Post by: Phil Harvey on December 05, 2020, 09:57:11 AM
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
Title: Re: Conditionally Applying Time Zone Offsets
Post by: neebah on December 05, 2020, 11:04:13 AM
This did not work.  It set all of the offsettimedigitized to the same value
Title: Re: Conditionally Applying Time Zone Offsets
Post by: neebah on December 05, 2020, 11:07:54 AM
Nevermind.  I must've typed something down.  Should've copied and pasted (and modified)