ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: MtnBiker on April 05, 2024, 01:49:54 PM

Title: Add geotag except if already exist?
Post by: MtnBiker on April 05, 2024, 01:49:54 PM
I want to geotag images and do it without creating a copy (working on copies already), but I don't want to overwrite existing geotags if they exist. Does exiftool -geotag gpxLogs photoFolder -overwrite_original overwrite existing geotags? If so, can that be prevented?

➜ exiftool -ver
12.76
Title: Re: Add geotag except if already exist?
Post by: Phil Harvey on April 05, 2024, 01:57:12 PM
Add this to your command: -if "not $gpslatitude"

Note:  In your command, "gpxLogs" must be a file name (not a directory name), but it may contain wildcards.

- Phil
Title: Re: Add geotag except if already exist?
Post by: MtnBiker on April 05, 2024, 08:44:02 PM
Thanks Phil. I'm actually using exiftool via Ruby, so this is what I'm using system("exiftool", "-geotag",  "#{gpxLogs}", "#{photoFolder}", "-overwrite_original").

gpxLogs is a folder with sometimes contains more than one gpx file and has a folder of unneeded files. gpxLogs = <path to folder> + "/*.gpx".

You can probably guess at the code if you don't know Ruby, but #{variable} adds variable to the string. Yes my naming is not consistent. I guess it should be gpxLogsFolder, but so far I'm only using twice and one line apart. Probably could have done without the gpxLogs, but syntax for the call can get confusing. In fact, I'll have to deal with the double quotes.

Thank you for the prompt answer. It will be added to my call.