use of if to check is gpstimestamp exist in the files

Started by Jona, June 03, 2023, 12:44:38 PM

Previous topic - Next topic

Jona

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

StarGeek

#1
As it says in the docs under the -T (-table) option, using -T is the same as using -t -S -q -f.  The -f (-ForcePrint) option 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 .
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Jona

thank you StarGeek this works.

and your explanation 'why' is clear.