I'm using this command to copy the Software and Rating tags into both Keywords and Subject. After a LOT of fiddling, I found that I had to use -addTagsFromFile @ to get exiftool to merge Keywords and Subject when appending from multiple other tags. The documention says "this may seem strange" and well, it is :)
Because it works great, except when doing a batch.
So this works:
exiftool -P -overwrite_original_in_place -progress -addTagsFromFile @ "-Keywords<${Rating;$_=sprintf('rating:%d', $_)}" "-Keywords<${Software;$_=sprintf('software:%s', $_)}" "-Subject<${Rating;$_=sprintf('rating:%d', $_)}" "-Subject<${Software;$_=sprintf('software:%s', $_)}" test.jpg
Result is correct:
Rating : 1
Keywords : rating:1, software:Adobe Photoshop CS6 (Windows)
Subject : rating:1, software:Adobe Photoshop CS6 (Windows)
Software : Adobe Photoshop CS6 (Windows)
And to batch-process the whole directory, this doesn't work:
exiftool -P -overwrite_original_in_place -progress -addTagsFromFile @ "-Keywords<${Rating;$_=sprintf('rating:%d', $_)}" "-Keywords<${Software;$_=sprintf('software:%s', $_)}" "-Subject<${Rating;$_=sprintf('rating:%d', $_)}" "-Subject<${Software;$_=sprintf('software:%s', $_)}" .
Output is incorrect:
Rating : 1
Keywords : rating:s
Subject : rating:s
Software : Adobe Photoshop CC 2019 (Windows)
Where does that rating:s even come from? What is going on, and how do I make it work?
I'm using Exiftool 11.2.6.0 on Windows 10.
You didn't say so, but I'm guessing you are running the second command from a .BAT file, while your first command is from the command line. If so, reading FAQ 27 (https://exiftool.org/faq.html#Q27) should clear things up.
- Phil
Thanks for the super quick reply!
Yes, this was indeed the case. Actually it was a .CMD file, which in this case means the same thing.
I still don't understand where rating:s came from. I would have expected rating:d where my %d would collapse to just d. And another thing I don't understand is why is the software:.. keyword missing in the batch process? Even if I'm not properly escaping, it should still append multiple keywords, right?
Everything between the two % characters was interpreted as a (non-existent) CMD-script variable. There is a "s" immediately following the second "%". I'm guessing because I don't really know the CMD syntax.
- Phil
Ah, and that's why the software keyword didn't get added. Makes sense. Kind of :)
Anyway, thanks again. Happy holidays!