Hi, while my use case is pretty specific, it would apply to a lot of metatag copying from one file to another.
Let's say I have an original file with GPS data IMG_20220819_161316_00_016.insp
which I want to copy to another IMG_20220819_161316_00_016.jpeg
, the only difference being the extension. I'd run the following just fine:
exiftool -tagsfromfile %f.insp -gps:all -r -ext jpg
However, the exported file has a different pattern, but could still be matched by part of the filename:
From IMG_20220819_161316_00_016.insp
to IMG_20220819_161316_00_016_2022-08-29_15-34-39_screenshot.jpg
(The second date in the screenshot file is the export date/time, which is useful)
I could rename the target files first, but there could potentially be several different exports per single source, so the current file naming actually makes sense. How would I adjust the command to something that updates GPS data on all files matching this pattern:
IMG_20220819_161316_00_016_*.jpeg
from the source IMG_20220819_161316_00_016.insp
Hope this makes sense and thanks in advance!
The percent variables can be edited. See the of Advanced features section of the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).
For example, in the case of IMG_20220819_161316_00_016.insp and IMG_20220819_161316_00_016_2022-08-29_15-34-39_screenshot.jpg, the insp file is the first 26 characters of the jpg file name. So you could use
exiftool -tagsfromfile %26f.insp -gps:all -r -ext jpg /path/to/files/
Additionally, you're not limited to one -TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT). If you had multiple filename formats, you can use multiple -TagsFromFile. Let's say you have another filename that has 5 leading character to remove.
exiftool -tagsfromfile %26f.insp -gps:all -tagsfromfile %.5f.insp -gps:all -r -ext jpg /path/to/files/
You do need to repeat the tags to copy for each -TagsFromFile option.
Fantastic, thanks very much StarGeek!