Problems with -tagname^=

Started by herb, December 05, 2021, 05:36:40 AM

Previous topic - Next topic

herb

I am working with version 12.36 on a Windows 10 system.

A (more or less) long time ago I worked with ExifTool feature: create a tag with empty content.
I am sure that the command -tagname^= worked properly.
(Sorry, but I do not remember which version I used for my tests in the past.)

Doing a retest of this feature with my application I have seen that this is broken.
This feature is still decribed in helpfile:
Quote"^=" is used to write an empty string instead of deleting the tag ...

E.g. for command
exiftool.exe -exif:software^= testimage.jpg
- I get as answer "1 file updated", but the tag is deleted (in case the tag does exist before).
- I get as answer (with option -v3): "Deleting IFD0:Software" and file keeps unchanged (in case of tag should be created)

Same happens e.g. for
- listtype tag: exiftool.exe -iptc:by-line^=
- lang-alt tags: exiftool.exe -xmp-dc:rights^= -xmp-dc:rights-de^=

I agree that this feature will be used (very) rarely, but it is decribed in help.
So please have a look at this problem.

Please allow also some additional questions:
- will this feature work only for tags with strings as values or
  will it work also for e.g. a date/time tag
- in case of a lang-alt: will it work for each "language depending sub-tag" or only for the x-default base-tag

Thankyou very much in advance
Best regards
herb

Phil Harvey

Hi Herb,

This still works for me:

exiftool a.jpg -exif:software^= -v3
Writing IFD0:Software
======== a.jpg
Rewriting a.jpg...
  Editing tags in: APP0 APP1 IFD0 JFIF
  Creating tags in: APP1 IFD0
JPEG APP1 (96 bytes):
    0000: 45 78 69 66 00 00 4d 4d 00 2a 00 00 00 08 00 05 [Exif..MM.*......]
    0010: 01 1a 00 05 00 00 00 01 00 00 00 4a 01 1b 00 05 [...........J....]
    0020: 00 00 00 01 00 00 00 52 01 28 00 03 00 00 00 01 [.......R.(......]
    0030: 00 02 00 00 01 3b 00 02 00 00 00 03 6d 65 00 00 [.....;......me..]
    0040: 02 13 00 03 00 00 00 01 00 01 00 00 00 00 00 00 [................]
    0050: 00 00 00 48 00 00 00 01 00 00 00 48 00 00 00 01 [...H.......H....]
  Rewriting IFD0
    + IFD0:Software = ''
JPEG DQT (130 bytes):
JPEG SOF0:
JPEG DHT (73 bytes):
JPEG SOS
    1 image files updated


List-type tags and lang-alt tags are written the same way as when you write a normal value.  The only difference with "^=" is that it accepts a zero-length string as a value.  It can be used for any tag where a zero-length string is a valid value.

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

herb

Hello Phil,

thanks for your quick reply and for your investigations.

Reading your answer I was astonished that it worked on your side. So I repeated my tests under various conditions.
At the end I found the solution:
In DOS-box of my Windows system I have to put strings with character ^  inside quotation marks ". Otherwise ^ will not be sent to Exiftool.

I apologize for making so much noise.
Best regards
herb

StarGeek

The caret ^ is an escape key in Windows CMD (not sure about PowerShell).  So it either needs to be enclosed in quotes or doubled so it escapes itself.
"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

I will add a note in the documentation that this must be quoted in Windows.

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