Remove selective IPTC Keywords

Started by amitinddr, February 24, 2014, 06:47:12 AM

Previous topic - Next topic

amitinddr

Hey Phil
Can you help me with command to remove selective IPTC keywords? So for example if I have a set of 2000 images with 400 of them having a particular keyword "System", I would just like to remove the Keyword system so that 400 images turn without any IPTC keywords whereas remaining 1600 retain the Keywords.

PS: I am using ExifTool GUI. Direct command for that will help best please.

Thanks
Amit

Phil Harvey

Hi Amit,

I think this is the command you want:

exiftool -keywords-="System" DIR

where DIR is the directory containing the images.

In ExifTool GUI direct, you should leave off the "exiftool" and directory specification.

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

amitinddr

Thanks Phil
Seems they are added in XPKeywords as well. Will this work to remove them from XPKeywords? Did not work for me :(

exiftool -XPKeywords-="System" DIR

Phil Harvey

No.  XPKeywords is not a list-type tag.

You must do something like this instead to edit the string value:

exiftool "-xpkeywords<${xpkeywords;s/( ,)?System( ,)?//}" ...

This removes "System" from the string, and any leading or trailing ", " delimiters.

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

amitinddr

Phil this is not working for me. It is instead adding s/( as a new keyword.

Phil Harvey

#5
What version of ExifTool are you using?  This feature was added in version 9.15.

- Phil

Edit:  Also, I got the delimiters wrong.  This is a bit trickier than I thought.  Try this:

exiftool "-xpkeywords<${xpkeywords;s/^System, //;s/, System$//;s/, System, /, /}" -xpkeywords-=System ...

This handles the keyword at the start, end, or middle of the string properly, and deletes XPKeywords if it is the only keyword.
...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 ($).

amitinddr


amitinddr

System is the only keyword. There are no other keywords for same file and I want to remove System.

Phil Harvey

Oh.  Then simply -xpkeywords-=System should work.

I need more details to figure out the problem.   This is what I get:

> exiftool a.jpg -xpkeywords
XP Keywords                     : System
> exiftool a.jpg -xpkeywords-=System
    1 image files updated
> exiftool a.jpg -xpkeywords
>


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

amitinddr


Phil Harvey

OK, so what changed?  You tried exactly this in a previous post.

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

amitinddr

Yes, seems updating the Exiftool version helped.

Something new here - My IPTC keywords are being shown as keyword1*keyword2 whereas in XPKeywords they are shown as Keyword1;Keyword 2. Is there a way I can have them as

IPTC
Keywords: Keyword1
Keywords: Keyword2

Thanks
Amit

Phil Harvey

No, sorry.  But you can change the IPTC Keywords delimiter to whatever you want with the -sep option.

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