Hello Phil,
to replace a specific tag-value with
exiftool -tag-=<value> -tag=<newvalue>
is a wonderful feature. Thanks for it.
Now I ask whether this feature can be combined with copying a tag-value to another tag.
The following example
exiftool -software-<$model <image>
worked as expected: software was deleted only in case of the existing value of software was identical to content of $model.
But e.g. the following examples
exiftool -software-<$model -software<$make <image>
exiftool -software-=ABC -software<$make <image>
exiftool -software-<$model -software=MAKE <image>
did not work. Independent of value of software its new value always was content of $make, resp. MAKE.
Do I something wrong or have I overseen a specific detail?
Thanks for your comments/help in advance.
Best regards
Herb
Hi Herb,
Rather, it seems that I have overlooked something...
I'll look into this.
- Phil
Ah. Silly me. I wasn't thinking. This is the reason (from the -tagsFromFile documentation):
5) The normal behaviour of copied tags differs subtly from that of
assigned tags for list-type tags. When copying to a list, each
copied tag overrides any previous operations on the list. [...]
Similarly, -addTagsFromFile must be used when conditionally
replacing a tag to prevent overriding earlier conditions.
So a command would be:
exiftool -addtagsfromfile @ "-software-<$model" "-software<$make" FILE
- Phil
Hello Phil,
thanks for the private lession. It works great.
Best regards
Herb
Hello Phil,
sorry annoying you again.
Yesterday I did only a quick test which was working properly.
My interpretation of your comment is, that -addtagsfromfile @ has always to be added in case of a $-variable comes into play.
Repeating all tests I have seen the following:
exiftool -software-<$model -software<$make <image> and
exiftool -software-=ABC -software<$make <image>
with correct replace-value: -software is deleted but not replaced
with different replace-value: is working as expected
exiftool -software-<$model -software=MAKE <image> is still not working
What must I do?
Best regards
Herb
Hi Herb,
I don't see -addtagsfromfile in any of these commands.
- Phil
Hello Phil,
yes, you are right. Editing this post I was so concentrated on the tags itself that I did not add -addtagsfromfile @ here inside the post. Working with DOS-box I of course used it. So I will repeat my commands: ( but characters " - necessary in DOS-box - are still omitted here):
exiftool -addtagsfromfile @ -software-<$model -software<$make <image> is working properly
exiftool -addtagsfromfile @ -software-=ABC -software<$make <image>
with correct replace-value ABC: -software is deleted but not replaced
with different replace-value ABC: is working as expected
exiftool -addtagsfromfile @ -software-<$model -software=MAKE <image> is also not working
Independent of replace-value MAKE is always set.
Sorry again that I gave not all details editing my previous post.
Best regards
Herb
Hi Herb,
In your 2nd command you've got the -addTagsFromFile in the wrong location.
4) The order of operations is to copy all specified tags at the
point of the -tagsFromFile option in the command line.
You need to put it after the -=.
Also, see common mistake 5b (https://exiftool.org/mistakes.html#M5).
But you are right that the 3rd command doesn't work. I'll look into this.
- Phil
Hi Herb,
The problem with the 3rd command was in ExifTool. This will be fixed in version 10.61.
Thanks for pointing this out.
- Phil
Hello Phil,
thanks for the corrections in version 10.61 and thanks for being so patient.
I have retested it and it works great.
Best regards
Herb
Hi Herb,
Great.
- Phil