If statement and TagsFromFile

Started by RPSM, September 20, 2018, 04:00:34 AM

Previous topic - Next topic

RPSM

I'm having some issues combining both of these, and I'm not sure how they work together. If I specify both a source and destination file for the TagsFromFile statement, then what does the If statement evaluate? The source or the destination?

This is my example (I'm copying GPS information from a JPEG to an MP4 - this works - but I only want to do it if the MP4 doesn't already have GPS information):

exiftool -TagsFromFile source.jpg "-gpslongitude<gpslongitude" "-gpslatitude<gpslatitude" -if '(exists $gpslongitude)' dest.mp4

Phil Harvey

The -if option always acts on the target FILE specified on the command line (not the -tagsfromfile SRCFILE.)

So it works the way you want for your command, but I think you want to test for -if 'not $gpslongitude'.

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

RPSM

Aha! Lovely, that was it, too much thinking on my part (or not enough). This is a great way to fix up drone footage where the GPS data isn't stored, for example the DJI Mavic Air. Thanks!!