Ignored superfluous tag name or invalid option: -sep ", "

Started by Randolf, April 12, 2022, 08:35:20 PM

Previous topic - Next topic

Randolf

So, I have managed to clean up my Lightroom catalog, gathered all the keywords and synonyms together with the associated file names in one place, and now, all what is missing is just (famous word...) writing the tags to the earlier exported 60k jpg files. And I'm stuck.

What I'm trying is:
exiftool -@ argfile.txt

with argfile.txt:

-all=
-sep ", "
-keywords="one, two, three"
-subject="one, two, three"
b.jpg
-execute
-all=
-keywords="four, five, six"
-subject="four, five, six"
a.jpg


and all I get is:


Invalid TAG name: "sep ", ""
Ignored superfluous tag name or invalid option: -sep ", "
    1 image files updated
    1 image files updated
File Name                       : a.jpg
Keywords                        : "four, five, six"
Subject                         : "four, five, six"
File Name                       : b.jpg
Keywords                        : "one, two, three"
Subject                         : "one, two, three"


when running the very same arguments (simply copy-pasted to the command line) as

exiftool -all= -sep ", " -keywords="one, two, three" -subject="one, two, three" b.jpg -execute -all= -keywords="four, five, six" -subject="four, five, six" a.jpg

I get correctly

    1 image files updated
    1 image files updated
File Name                       : a.jpg
Keywords                        : four, five, six
Subject                         : four, five, six
File Name                       : b.jpg
Keywords                        : one, two, three
Subject                         : one, two, three


What did I do wrong? Please advice...
.
PS: I have tried the argfile-version under both, Win10 and Linux (WSL2). Exiftool version is 12.41

StarGeek

This is FAQ #29.  You have the -sep option and it's argument on the same line and with quotes.  See also the -@ (Argfile) option.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Randolf

Thanks for the fast reply. But unfortunately, either I'm too stupid to understand your answer or it doesn't do the trick, alas:

I have tried several options before and based on your links, like

-sep ", "


-sep
", "


-sep
,


leaving the -sep option away altogether (as it is said to be the default), rewriting the file in Windows and Linux (to avoid a potential end-of-line problem... No way to get it running...

StarGeek

Using
-sep
,

is the correct way to do it.  Make sure you have a trailing space after the comma but no trailing spaces elsewhere.

Example output
C:\>type temp.txt
-sep
,
-keywords=one, two, three
-subject=one, two, three

C:\>exiftool -@ temp.txt y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -sep ## -Subject -Keywords y:\!temp\Test4.jpg
[XMP-dc]        Subject                         : one##two##three
[IPTC]          Keywords                        : one##two##three
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Randolf

Thanks a lot for the info that double quotes are not allowed in the argfile.

Together, there were several problems masking each other:

1) I found the statement "Arguments in ARGFILE behave exactly the same as if they were entered at the location of the -@ option on the command line" in the command line options documentation not so clear that there must not be double quotes in the argfile. I'd rather understood that the double quotes are mandatory as on the command line.

Removing the double quotes from the keywords helped.
       
2) From the default output format of exiftool one cannot tell whether a comma belongs to the keyword (as in "one, two", "three") or is used to separate keywords in the list ("one", "two", "three"). A look at the Windows Explorer > File Properties > Details tab revealed this trap as it uses semicolons to separate the keywords.

Message learned: Using commas in keywords, despite being seducing and allowed, are a way to make yourself unhappy.

3) Using ## as a separator in the argfile to use commas in keywords does not work for me (understood as the beginning of a comment?). Using // or | works.

    -Randolf

StarGeek

Quote from: Randolf on April 13, 2022, 05:07:11 AM
1) I found the statement "Arguments in ARGFILE behave exactly the same as if they were entered at the location of the -@ option on the command line" in the command line options documentation not so clear that there must not be double quotes in the argfile. I'd rather understood that the double quotes are mandatory as on the command line.

Just pointing out that you skipped the entire first paragraph of the -@ (Argfile) option which says, among other things
     Normal shell processing of arguments is not performed, which among other things means that arguments should not be quoted and spaces are treated as any other character.

Also, quotes are not mandatory.  They are only needed in cases where the shell/CMD will interpret characters differently.  For example, redirection </> and pipe | characters.  In the case of windows, ampersands & and carets ^.  And of course, spaces.  And the type of quotes is system dependent.  Double quotes would be used on Windows CMD, while single or double quotes would be used on Mac/Linux except when there's an asterisk * (I think) or dollar sign $.

These are not exiftool things.  They are properties of the command line.

Quote2) From the default output format of exiftool one cannot tell whether a comma belongs to the keyword (as in "one, two", "three") or is used to separate keywords in the list ("one", "two", "three"). A look at the Windows Explorer > File Properties > Details tab revealed this trap as it uses semicolons to separate the keywords.

This is just an easy way to display list type tags.  Internally, they are kept completely separate, not as any type of comma or semicolon separated string (except for the Windows only XPKeywords).  See this post which shows how XMP list tags are stored.  "one" and "two" are completely separated.

FAQ #17 has details on list type tags and how they are handled.

Quote3) Using ## as a separator in the argfile to use commas in keywords does not work for me (understood as the beginning of a comment?). Using // or | works.

I use double hash marks as it makes the separations obvious and is unlikely to be part of an actual keyword.  But as it says in the in the docs for the -@ (Argfile) option, hashtags have special meaning.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).