Dear all,
Let's say I have a folder with 10 JPGs and I want to write an XMP record inside two of those. For now, I use this command:
exiftool -tagsfromfile "2022-11-21_Z7ii-B_0001.jpg" "2022-11-21_Z7ii-B_0006.jpg" "-xmp:all<all" "2022-11-21_Z7ii-B_0001.jpg" "2022-11-21_Z7ii-B_0006.jpg" -overwrite_original
This works, bit I have two questions:
- is there a more elegant way to do this or should I have the list of input files and output files determined like this?
- Exftool tells me "3 images updated". Why does it say 3 and not 2? I checked (without the -overwrite_original option) and only two files get updated.
Thanks for any insights! Geert
Quote from: gEEvEE on May 10, 2023, 06:05:34 AMExftool tells me "3 images updated". Why does it say 3 and not 2? I checked (without the -overwrite_original option) and only two files get updated.
I believe you are misunderstanding the
-TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT). Tags are copied
only from the file directly after
-TagsFromFile.
So you are copying from
2022-11-21_Z7ii-B_0001.jpg
and copying to
2022-11-21_Z7ii-B_0006.jpg
because that is the filename that is by itself. It is not a source for
-TagsFromFileThen you are copying the data from
2022-11-21_Z7ii-B_0001.jpg
back into itself
And then you are copying into 2022-11-21_Z7ii-B_0006.jpg again, because you have it listed twice.
Understand, filenames do not have to appear at a specific place in the command. They can appear almost anywhere as long as they don't split a two part option.
Quote from: gEEvEE on May 10, 2023, 06:05:34 AMis there a more elegant way to do this or should I have the list of input files and output files determined like this?
It depends upon what you are actually trying to do. You appear to be trying to copy in a circle, from 2022-11-21_Z7ii-B_0001.jpg->2022-11-21_Z7ii-B_0006.jpg->2022-11-21_Z7ii-B_0001.jpg->2022-11-21_Z7ii-B_0006.jpg
Hi StarGeek, it is true that I am still trying to get the hang out of it.
Essentially, I have a folder with JPG files and I want to embed an XMP metadata section in them.
With the following command, I can do this for all JPG files in the folder
exiftool -tagsfromfile %d%f.jpg "-xmp:all<all" -ext jpg DIR
Now, I can also do this for just one file like this:
exiftool -tagsfromfile 2023-04-05_Z7ii-B_0002.jpg "-xmp:all<all" 2023-04-05_Z7ii-B_0002.jpg
So now my question was how to do this for three or four specific JPEG files in one command. I played a bit around and this command seems to work:
exiftool -tagsfromfile %d%f.jpg "-xmp:all<all" "2023-04-05_Z7ii-B_0002.jpg" "2023-04-05_Z7ii-B_0016.jpg"
So I think I could solve it. But feel free to tell me a more elegant way if there would be any.
Cheers, Geert
The last command is pretty much it. You can mix any number of filenames and/or directories up until the character limit of the command line you are using (which is about 8,000 for Windows and a huge number for other systems).
So you could have
exiftool <commands> file1.jpg /path/to/Directory1 ../Parent/new/path/Directory2 /another/directory/file3.jpg
and so on. And the %d and %f will always stand for the directory and base filename of the file currently processed.
Cheers. Much appreciated! Geert