Hi
I have an args file to remove some metadata from jpeg files after exporting from Lightroom. I am trying to remove all the XMP-xmpMM tags except the PreservedFileName tag that I am very keen to retain.
My Args file has this line:
-XMP-xmpMM:all --xmpMM-PreservedFileName=
But this removes all the xmpMM tags including PreservedFileName. Tried various different methods but failed to retain PreservedFileName, any suggestions please as to what I am doing wrong?
I think this extract from the documentation may help :
--TAG
Exclude specified tag from extracted information. Same as the -x option. Group names and wildcards are permitted as described above for -TAG. Once excluded from the output, a tag may not be re-included by a subsequent option. May also be used following a -tagsFromFile option to exclude tags from being copied (when redirecting to another tag, it is the source tag that should be excluded), or to exclude groups from being deleted when deleting all information (eg. -all= --exif:all deletes all but EXIF information). But note that this will not exclude individual tags from a group delete (unless a family 2 group is specified, see note 4 below). Instead, individual tags may be recovered using the -tagsFromFile option (eg. -all= -tagsfromfile @ -artist).
Something like this:
-XMP-xmpMM:all= -tagsfromfile @ -xmpMM-PreservedFileName
There must be one argument per line in an ARGFILE. The line you used will give unexpected results.
- Phil
Quote from: Phil Harvey on February 14, 2025, 09:00:22 AMThere must be one argument per line in an ARGFILE. The line you used will give unexpected results.
- Phil
Right - I missed that this was an arg file - and it does give very unexpected results.
(Although it does work on the command line without an arg file).
Is it possible to achieve what the OP asked for?
Yes, using the command you provided.
- Phil
I can see the following tags in the file:
Quote[XMP-xmpMM] PreservedFileName : Z81_5961
[XMP-xmpMM] DocumentID : xmp.did:6d8b6d12-965f-1e42-bf32-7b04135a2fed
[XMP-xmpMM] OriginalDocumentID : 1C3269453669BACFED0D159C5E314B44
[XMP-xmpMM] InstanceID : xmp.iid:6d8b6d12-965f-1e42-bf32-7b04135a2fed
[XMP-xmpMM] DerivedFromDocumentID : 1C3269453669BACFED0D159C5E314B44
[XMP-xmpMM] DerivedFromOriginalDocumentID : 1C3269453669BACFED0D159C5E314B44
But these lines in my arg file
-XMP-xmpMM:all=
-tagsfromfile XMP-xmpMM:PreservedFileName
fails with
QuoteInvalid TAG name: "tagsfromfile XMP-xmpMM:PreservedFileName"
Ignored superfluous tag name or invalid option: -tagsfromfile XMP-xmpMM:PreservedFileName
-XMP-xmpMM:all=
-tagsfromfile -XMP-xmpMM:PreservedFileName
fails with
QuoteInvalid TAG name: "tagsfromfile -XMP-xmpMM:PreservedFileName"
Ignored superfluous tag name or invalid option: -tagsfromfile -XMP-xmpMM:PreservedFileName
if I separate the args line into three lines:
-XMP-xmpMM:all=
-tagsfromfile
-XMP-xmpMM:PreservedFileName
still fails with this error message
QuoteInvalid TAG name: "tagsfromfile "
Ignored superfluous tag names or invalid options: -tagsfromfile ...
Not sure what I am doing wrong.
Quote from: Ad_Astra on February 14, 2025, 10:05:16 AMBut these lines in my arg file
-XMP-xmpMM:all=
-tagsfromfile XMP-xmpMM:PreservedFileName
fails with
Invalid TAG name: "tagsfromfile XMP-xmpMM:PreservedFileName"
Ignored superfluous tag name or invalid option: -tagsfromfile XMP-xmpMM:PreservedFileName
This is FAQ #29, "My options don't work in a -@ ARGFILE" (https://exiftool.org/faq.html#Q29). Because
-tagsfromfile XMP-xmpMM:PreservedFileName is all on one line, exiftool is looking for a tag with that name, not the
-TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT). This breaks because tag names cannot have spaces in them.
Quote-XMP-xmpMM:all=
-tagsfromfile -XMP-xmpMM:PreservedFileName
fails with
Invalid TAG name: "tagsfromfile -XMP-xmpMM:PreservedFileName"
Ignored superfluous tag name or invalid option: -tagsfromfile -XMP-xmpMM:PreservedFileName
Same issue
Quoteif I separate the args line into three lines:
-XMP-xmpMM:all=
-tagsfromfile
-XMP-xmpMM:PreservedFileName
still fails with this error message
Invalid TAG name: "tagsfromfile "
Ignored superfluous tag names or invalid options: -tagsfromfile ...
Getting closer. Note what is between the quotes. You have a trailing space, so exiftool is looking for a tag called
"tagsfromfile " (trailing space included) and that fails for the same reason as above.
Now, the next problem that will pop up. The
-TagsFromFile option requires the name of a file to copy the data from. In your command, you will be attempting to copy from a file called "-XMP-xmpMM:PreservedFileName".
Try this for your args file. Make sure there aren't any trailing spaces anywhere in the args file.
-XMP-xmpMM:all=
-tagsfromfile
@
-XMP-xmpMM:PreservedFileName
Thanks StarGeek
Your example worked perfectly, not sure what the @ symbol means I guess it is providing the filename?
Quote from: Ad_Astra on February 14, 2025, 11:42:03 AMYour example worked perfectly, not sure what the @ symbol means I guess it is providing the filename?
From the docs on the
-TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT)
QuoteSRCFILE may be the same as FILE to move information around within a single file. In this case, @ may be used to represent the source file (ie. -tagsFromFile @), permitting this feature to be used for batch processing multiple files