exiftool

To remove all but a certain tag that has spaces in its name


To remove all but a certain tag that doesn't have spaces in its name, e.g., foo, I use

exiftool -overwrite_original_in_place -all= -tagsfromfile @ -foo input.jpg

But how to remove all but a certain tag that does have spaces in its name, e.g., foo bar? I have tried both

exiftool -overwrite_original_in_place -all= -tagsfromfile @ -"foo bar" input.jpg
exiftool -overwrite_original_in_place -all= -tagsfromfile @ "-foo bar" input.jpg

but neither seems to work for me.


Solution

  • Same question on the Exiftool forums

    This is Exiftool FAQ #2/#3. Only tag descriptions have spaces in them. Tag names do not have spaces. As mentioned in those FAQs, you have to add the -s (-short) option to get tag names.