Questions to options -m and -f -api missingtagvalue=

Started by herb, March 18, 2022, 07:15:23 AM

Previous topic - Next topic

herb

Hello Phil,

In the following I talk about the usecase to assign the value of tag1 also to tag2
exiftool.exe -tag2 < $tag1

In detail I have questions when tag1 is missing in sourcefile.

(1) Without any further option Exiftool does nothing
(2) Using also option -m Exiftool
    - ignores minor warnings and
    - value of tag1 is handled as empty string (with length 0)
(3) Using also option -f and -api missingtagvalue=x
    - tag2 gets value x assigned
(4) Using also option -m and -api missingtagvalue=x
    - ignores minor warnings and
    - tag2 gets value x assigned

Now my question:
Is it also possible to set missingtagvalue to an empty string (length 0)
in order to have:
- value of tag1 is handled as empty string (with length 0)
- AND Exiftool does NOT ignore minor warnings

Thanks for your help in advance
Best regards
herb

StarGeek

I am unable to do so under Windows.  Using -f -api missingtagvalue="" results in the default dash being used.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Use ^= to set any option or tag value to an empty string.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

I believe the context is this thread where the command
exiftool "-ImageDescription<$IPTC:City $IPTC:Province-State $IPTC:Country-PrimaryLocationName" file.jpg
would fail if Province-State didn't exist.

What herb wants is to use a empty string for -f -api missingtagvalue without suppressing minor errors -m.

Though my thought is that you're still going to have to edit afterwards in order to change the two spaces into a single space.  Overall, I think either the user defined tag or the shortcut I mention in that thread is the easiest option if you were dealing with trying to combine more than a few tags.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Quote from: StarGeek on March 18, 2022, 01:20:46 PM
What herb wants is to use a empty string for -f -api missingtagvalue without suppressing minor errors -m.

Yes.  This should work (-f or -m not needed):

exiftool -api missingtagvalue^= ...

QuoteThough my thought is that you're still going to have to edit afterwards in order to change the two spaces into a single space.  Overall, I think either the user defined tag or the shortcut I mention in that thread is the easiest option if you were dealing with trying to combine more than a few tags.

Agreed.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

I tried that and made an error that I should have remembered.  The caret is special in Windows command line.

-api "missingtagvalue^="
works with the added quotes.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

herb

Hello StarGeek, hello Phil

thank you very much for your investigations and your comments.
QuoteUse ^= to set any option or tag value to an empty string.
Wow! Great feature.
I never had such an idea and will continue with this.

Thanks again and
Best regards
herb