News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Move the "Success" - Leave only "Leftovers"

Started by pucenavel, March 19, 2020, 11:04:41 PM

Previous topic - Next topic

pucenavel

I'm attempting to set up a command line that will GeoTag my photos from a GPX Track.  I'm using the GeoMaxIntSecs and GeoMaxExtSecs to exclude photos that are outside of the GPX range by more than 60 seconds.  I was attempting to have the Output go to a different folder so that I would know what got processed and what didn't.

So...

exiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geotag Track.gpx /source

Gets me part way there, but I wanted to have the files that got tagged go away and leave the files that didn't behind (to either process manually or apply against another GPX).

I tried...

exiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geotag Track.gpx -o /output /source

But that moved all the files to the output folder whether they got tagged or not, as well as leaving the originals behind in the source folder (and without tagging them as original, so I can't run exiftool -delete_original to remove them.

By the way - my ORIGINAL originals are still on the memory card - I'm not worried about losing them.  I keep the true source originals separately.

Any suggestions?

Thanks!

Phil Harvey

Interesting.

Offhand I can't think of a way to do this in a single step.  How about this 2-step command?:

exiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geotag Track.gpx -execute -directory=/output/source -if "$gpslatitude" -common_args DIR

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

pucenavel

Thank you!

As a newbie, I just want to make sure I'm learning as I go.

Up until the -execute is the first command (using the common_args location as the source location) - got that from the documentation.

I'm not finding much on what $gpslatitude does.  I assume that the -directory and -if part of the statement is basically saying "move the files to the new location IF they contain a gps latitude"?

If that's the case, I think I might run it like....

exiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geotag Track.gpx -execute -directory=OUTPUT -if "$gpslatitude" -execute -delete_original -common_args DIR

Where OUTPUT is the destination folder I'm sending it and DIR is where the original images and my GPX file are located

In effect...
1. Tag the files
2. move the ones that got tagged
3. delete any originals that got left behind

which should leave my untagged images sitting untouched in the source location

Right?

StarGeek

Quote from: pucenavel on March 20, 2020, 06:50:16 PM
I'm not finding much on what $gpslatitude does. 

From the docs on the -if option
   EXPR is a Perl-like logic expression containing tag names prefixed by $ symbols.
In this case, the tag name is GPSLatitude.

Quote-if part of the statement is basically saying "move the files to the new location IF they contain a gps latitude"?

Yes

Quote-directory
You can find details on the Directory tag on the Extra Tags page and the Writing "FileName" and "Directory" tags page

Quoteexiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geotag Track.gpx -execute -directory=OUTPUT -if "$gpslatitude" -execute -delete_original -common_args DIR
...
3. delete any originals that got left behind

If you are certain the command is doing exactly what you want, you can use the -Overwrite_Original option instead.  See third paragraph under the -o (outfile) option.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

pucenavel

Again, thanks for the help.

I've got two of the three parts working (GeoTag, Move, Delete Originals).  To get it all worked out, I've broken into three commands that I'll chain together with -execute later.

The one I'm having issues with is...

exiftool -directory=/Users/Me/Desktop/Review -if '$gpslatitude' /Users/Me/Desktop/GeoTag

It keeps returning this error.

1 directories scanned
4 files failed condition
0 image files read


I'm not familiar with Perl, so I'm unsure what variations to try.  I am on a Mac for what its worth.

StarGeek

Quote from: pucenavel on March 21, 2020, 03:25:22 PM
exiftool -directory=/Users/Me/Desktop/Review -if '$gpslatitude' /Users/Me/Desktop/GeoTag

Not a Perl issue, a Mac issue.  Your computer is "helping" by automatically replacing regular quotes, which are required for the terminal, with fancy quotes.

See this SuperUser answer for how to turn them off.

Another thing to be careful of is copy/pasting into a word processor/Google docs.  Those will also try and "help" you.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

pucenavel

Success!

exiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geosync=HH:MM:SS -geotag Track.gpx -execute -delete_original -execute -directory=/Users/jessesmith/Desktop/Review -if '$gpslatitude' -common_args /Users/jessesmith/Desktop/GeoTag

I'll probably modify to either overwrite original or bypass the verification after I've used it a few times.

Learned one more tidbit on this last pass.  Deleting Originals only seems to work if the copy is still there, so the Delete function needs to be run before the Move function.

Thanks!!!

Phil Harvey

As StarGeek said, if you don't want the _original files, then use -overwrite_original.  No need to use -delete_original in a separate step.  So your command should be:

exiftool -api GeoMaxIntSecs=10 -api GeoMaxExtSecs=60 -geosync=HH:MM:SS -geotag Track.gpx -overwrite_original -execute -directory=/Users/jessesmith/Desktop/Review -if '$gpslatitude' -common_args /Users/jessesmith/Desktop/GeoTag

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