ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: delerious on May 07, 2023, 09:12:50 PM

Title: Is it possible to display an empty string instead of - for a missing tag?
Post by: delerious on May 07, 2023, 09:12:50 PM
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           : ''
Title: Re: Is it possible to display an empty string instead of - for a missing tag?
Post by: Phil Harvey on May 07, 2023, 09:14:15 PM
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
Title: Re: Is it possible to display an empty string instead of - for a missing tag?
Post by: StarGeek on May 07, 2023, 09:15:37 PM
The caret is a special character under Windows, so you'll need to put it in quotes if that's your OS.
Title: Re: Is it possible to display an empty string instead of - for a missing tag?
Post by: Phil Harvey on May 07, 2023, 09:32:00 PM
@StarGeek:  Good point.  Thanks.  So:

-api "missingtagvalue^="

- Phil
Title: Re: Is it possible to display an empty string instead of - for a missing tag?
Post by: delerious on May 07, 2023, 09:43:10 PM
Thanks guys!

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

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