Add geotag except if already exist?

Started by MtnBiker, April 05, 2024, 01:49:54 PM

Previous topic - Next topic

MtnBiker

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

Phil Harvey

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

MtnBiker

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.