ExifTool Forum

ExifTool => Newbies => Topic started by: Jona on June 03, 2023, 12:44:38 PM

Title: use of if to check is gpstimestamp exist in the files
Post by: Jona on June 03, 2023, 12:44:38 PM
Good evening

I have a folder containing several subfolders where the pictures are stored.
As the pictures are all taken at the same place, I decided to use a generic GPS location from an existing picture using -tagsfromfile. This worked well no issues the GPS tags were copied.

In order to avoid confusion between the time of the picture and the time of the GPS I decided to remove the tags -gpstimestamp and -gpsdatestamp.

My first action is therefore to search in the directory tree for all pictures having a tag -gpstimestamp (or gpsdatestamp)

I am using the following command

exiftool -if '$gpstimestamp' -directory -filename . -r 

and it works well by listing the files where the tag is defined

but if I want to have the output in a table with command

exiftool -T -if '$gpstimestamp' -directory -filename . -r  

all files in the directory satisfy the criteria and are listed in the table.

What I am missing?

Have a good evening/day/nigth
Alexandre

I am using exiftool 12.62 on Mac OS Ventura 13.4
Title: Re: use of if to check is gpstimestamp exist in the files
Post by: StarGeek on June 04, 2023, 12:16:46 AM
As it says in the docs under the -T (-table) option (https://exiftool.org/exiftool_pod.html#T--table), using -T is the same as using -t -S -q -f.  The -f (-ForcePrint) option (https://exiftool.org/exiftool_pod.html#f--forcePrint) forces a result, a hyphen by default, even when they don't exist.  So when the -if checks to see if GPSTimeStamp exists, it will always return true, as it now contains a hyphen.

Instead of using -T, use the individual options that make it up, except for the -f, e.g.
exiftool -r -t -S -q -if '$GPSTimeStamp' -directory -filename .
Title: Re: use of if to check is gpstimestamp exist in the files
Post by: Jona on June 04, 2023, 03:50:46 AM
thank you StarGeek this works.

and your explanation 'why' is clear.