Copying tags between parallel directory structures?

Started by Jan.Steinman, April 07, 2024, 11:15:11 PM

Previous topic - Next topic

Jan.Steinman

I keep thinking this should be a common and simple thing to do, and I've searched the man page and this forum for examples, but I can't quite wrap my head around something that should be fairly simple: copying tag values between same-named files between two parallel directory structures.

I have two directories, "a" and "b". (Literally! I made "a" and "b" symlinks to the actual directories for simplicity. "b" is actually a backup copy of "a".)

Within these top directories are one- or two-levels of parallel sub-directories, eventually containing identically-named files.

exiftool -r -TagsFromFile 'b/%f' -GPSLatitude -GPSLongitude a
Is it really that simple, or am I missing something? I don't want to try it and screw things up!

Thanks!

StarGeek

%f is only the base filename and does not include the extension.  You can either include it (and the dot) with %f.%e or use %F, which is the full filename.

It will get more complex if you have subdirectories.  In that case you will have to include the %d variable for the directory, but it would require some editing.

See the -w (-TextOut) option for details on the percent variables and Writing "FileName" and "Directory" tags for more examples.

But basically, yes, your command is almost correct.  The one major thing that's missing is the GPS Reference directions.  GPS coordinates are divided into the actual numbers and then the reference direction, N/S/E/W/Above/Below sea level.

Assuming that you do have subdirectories, and you have CDed to the directory that contains both directory a and b, you command would look like this (%:1d removes the top level of the path, in this case the a)
exiftool -r -TagsFromFile 'b/%:1d/%f.%e' -GPSLatitude -GPSLatitudeRef -GPSLongitude -GPSLongitudeRef a

or you could shorten it with a wildcard to copy both the coordinates and reference at once
exiftool -r -TagsFromFile 'b/%:1d/%f.%e' -GPSLatitude* -GPSLongitude* a

"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

Jan.Steinman