Is it possible to display an empty string instead of - for a missing tag?

Started by delerious, May 07, 2023, 09:12:50 PM

Previous topic - Next topic

delerious

I know that if you use the -f option and specify a tag that does not exist, then it will print out a dash (-) by default for the value.

Is it possible to change the default value to empty string instead of dash? I have tried the following commands with the -api MissingTagValue option, but they don't output an empty string:

G:\Documents>exiftool -f -SubSecTimeOriginal -api MissingTagValue="" "h:\IMG_1833.jpg"
Sub Sec Time Original           : -

G:\Documents>exiftool -f -SubSecTimeOriginal -api MissingTagValue= "h:\IMG_1833.jpg"
Sub Sec Time Original           : -

G:\Documents>exiftool -f -SubSecTimeOriginal -api MissingTagValue='' "h:\IMG_1833.jpg"
Sub Sec Time Original           : ''

Phil Harvey

This is the correct syntax:

-api missingtagvalue^=

The ^= is a special operator that allows you to assign an empty value.  Otherwise simply = will delete the tag/option if a value isn't given.

- 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

The caret is a special character under Windows, so you'll need to put it in quotes if that's your OS.
"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

@StarGeek:  Good point.  Thanks.  So:

-api "missingtagvalue^="

- 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 ($).

delerious

Thanks guys!

On Windows, I found a few different ways to handle the caret.

-api "MissingTagValue^="
-api MissingTagValue"^"=
-api MissingTagValue"^="
-api MissingTagValue^^=