News:

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

Main Menu

tagsfromfile with a few files in a folder

Started by gEEvEE, May 10, 2023, 06:05:34 AM

Previous topic - Next topic

gEEvEE

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

StarGeek

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.  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 -TagsFromFile
Then 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
* 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).

gEEvEE

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

StarGeek

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.
* 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).

gEEvEE