Hello,
I can see how to assign one tag to the value of another. For example, this assigns the old value of Title to Comment, and assigns the string "New Title" to Title:
exiftool -Title="New Title" "-Comment<${Title}" a.jpg
Is there a way to reference the new value for Title ("New Title" in this case) in the assignment to Comment, so that the same string is written to Title and Comment?
Typically it is done like this:
exiftool -title="New Title" -comment="New Title" a.jpg
If you want the value of a single variable to be applied to both, typically this is done via a script or batch file, but you could do this with the -userparam option if you really wanted:
exiftool -userparam myvar="New Title" "-title<$myvar" "-comment<$myvar" a.jpg
- Phil
Aha - userparams looks like helpful magic for me, thanks.
I should mention that the UserParam option is slower than the scripting solution because copying tags like this adds the unnecessary step of reading tags from the file.
- Phil
Is is possible to dereference environment variables, like $ENV{title_value}?
-Comment<$ENV{title_value} doesn't work.
That would be done via the normal shell features. For Mac:
exiftool "-comment=$COMMENT" a.jpg
where COMMENT is an environment variable.
Note that you use "=" here because as far as ExifTool is concerned you are writing a constant string. The "$COMMENT" is expanded by the shell.
The exact syntax depends on the shell you are using.
- Phil
Thanks - at the moment my exiftool options are mostly in an args file which I run like .\exiftool -@ mytags.txt $*, so I don't get shell expansions.
One reason I try to keep everything in config files is to avoid confusing myself with quotes and escaping % signs :)
I'll break out the ones I need to the command line.