Multiple tags to the same list type

Started by ScannerBoy, May 11, 2022, 07:11:14 PM

Previous topic - Next topic

ScannerBoy

I am trying to replace tags in an existing XMP-iptcExt PersonInImage field using a command line argument file

I have read a couple of posts here which address this issue partially and I realize I do need to use the -addtagsfromfile option.
As I may well be trying to use this process to add several values to several individual  tags: PersonInInage, Subject, Keywords ...
do I need to make sure this option appears only once?

StarGeek

You should need it just once unless you are copying from more than one file.  This command would copy TAG2, TAG3, and TAG4 into TAG1, overwriting any previous contents of TAG1
exiftool -AddTagsFromFile @ "-TAG1<TAG2" "-TAG1<TAG3" "-TAG1<TAG4" file.jpg

This would copy TAG2 from from file.jpg, TAG3 from FileA.jpg, and TAG4 from FileB.jpg into TAG1 in file.jpg
exiftool -AddTagsFromFile @ "-TAG1<TAG2" -AddTagsFromFile FileA.jpg "-TAG1<TAG3" AddTagsFromFile FileB.jpg" -TAG1<TAG4" file.jpg
"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

ScannerBoy

Thank you for the example, but my main question relates to whether I have to be very careful to not duplicate the -AddTagsFromFile option.

Your example raised another question for myself.
I do want to replace all values for the specific tags, but will it matter whether I use "-TAG1<TAG2" or "-TAG1+<TAG2"

StarGeek

Quote from: ScannerBoy on May 11, 2022, 08:54:17 PM
I do want to replace all values for the specific tags, but will it matter whether I use "-TAG1<TAG2" or "-TAG1+<TAG2"

Yes, it matters.  See the last few lines in FAQ #17.
"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

ScannerBoy

Thank you for sticking with this.
I am afraid, I just realized that doing things via a response file - and that is the way I am trying to do this - would make a big difference.

What I am trying to do, is to add several names of the type "Doe, Joe"; "Doe, Jane"; "Doe, Kid" to  the  field
XMP-iptcExt: PersonInImage, replacing anything that might be there already.

Where I am stymied is with which options I do need and where they need to be split over separate lines and which bits need to be quoted - single or double quotes.

StarGeek

Quote from: ScannerBoy on May 12, 2022, 04:44:23 PM
I am afraid, I just realized that doing things via a response file

Response file?  Do you mean an Args file via -@ (Argfile) option and maybe -stay_open option?

QuoteWhat I am trying to do, is to add several names of the type "Doe, Joe"; "Doe, Jane"; "Doe, Kid" to  the  field
XMP-iptcExt: PersonInImage, replacing anything that might be there already.

Assuming Args file, then each entry on a separate line, no trailing spaces and no quotes (see FAQ #29).  You have multiple ways to add the data (FAQ #17).  The end result would be either
-PersonInImage=Doe, Joe
-PersonInImage=Doe, Jane
-PersonInImage=Doe, Kid

or using the -sep option
-sep
;
-PersonInImage=Doe, Joe;Doe, Jane;Doe, Kid

Normally, -sep would use a comma, but you don't want that here because a comma is in your names, so I used the semicolon, which must be on a separate line than -sep.

These commands will completely overwrite existing data.
"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

ScannerBoy

Yes, it was via  via -@ (Argfile)  and your first solution did the trick perfectly
:) Thank you.