For some reason I already assign keywords on hundreds of files with this Pattern:"01-Januari-2016". Afer I found a better way on naming this keyword I decide to delete those with :"01-Januari-2016" or any other month with the pattern of (*-*-2016). During deleting Keywords I want Exiftool to go through the folder and any subfolders and delete any keywords with pattern such as:"*-*-2016".
Regards,
Benny
Hi Benny,
I think this should do it (assuming the keywords are in IPTC:Keywords. If they are stored in XMP:Subject, use "Subject" instead of "Keywords" in the command below):
exiftool "-keywords<${keywords;s/(^|==)\d+-\w+-2016(==|$)/$1$2/g;s/====/==/g}" -sep == DIR
- Phil
Hi Phil,
I may missing something during running your command.
After running your command
exiftool "-keywords<${keywords;s/(^|==)\d+-\w+-2016(==|$)/$1$2/g;s/====/==/g}" -sep == DIR
on my directory, I grab the info from the first 11 files in the folder and I got
Keywords
Type-1A, 01-Agustus-2016, 2016:08:01 12:55:40
Type-1A, 01-Agustus-2016, 2016:08:01 13:52:18
Type-1A, 01-Agustus-2016, 2016:08:01 18:38:27
Type-1A, 01-Agustus-2016, 2016:08:01 18:54:11
Type-1A, 01-Agustus-2016, 2016:08:01 19:16:50
Type-1A, 01-Agustus-2016, 2016:08:01 19:50:59
Type-1A, 01-Agustus-2016, 2016:08:01 20:36:55
Type-1A, 01-Agustus-2016, 2016:08:01 21:48:44
Type-1A, 01-Agustus-2016, 2016:08:01 22:09:03
Type-1A, 01-Agustus-2016, 2016:08:01 22:30:42
Type-1A, 01-Agustus-2016, 2016:08:01 22:47:31
My problem is Keyword "01-Agustus-2016" still there (supposed to be deleted by using your command).I did a try this morning just to change one of them become "01-August-2016" and run again your command but still with same outcome.
Regards,
Benny
Hi Benny,
I think the keywords in your file are stored incorrectly. I don't have time to explain now, but see FAQ 17 (https://exiftool.org/faq.html#Q17)
- Phil
If you're on Windows, try this instead:
exiftool "-keywords<${keywords;s/(^|##)\d+-\w+-2016(##|$)/$1$2/g;s/####/##/g}" -sep ## DIR
I remember this coming up once before (but can't find the post) where Windows does something funky with double equal signs. When used with sep, they end up being a single equal sign.
C:\>exiftool -Keywords -sep == X:\!temp\Test3.jpg
Keywords : ocean=HiThere
But also, check the keywords on one of your files as Phil suggests, just in case. Run
exiftool -sep ## -keywords FILE
Assuming that you're keywords are properly separated and not one long keyword, you should see
Type-1A##01-Agustus-2016##2016:08:01 12:55:40
Edit: Might have been this thread (https://exiftool.org/forum/index.php/topic,3489.15.html).
Thanks StarGeek. I totally forgot (or didn't know about) the == problem. It really is hard choosing a unique separator that doesn't have some special meaning.
- Phil
Hi Phil, StarGeek,
exiftool "-keywords<${keywords;s/(^|##)\d+-\w+-2016(##|$)/$1$2/g;s/####/##/g}" -sep ## DIR is work for me.
After running the command and create report,I got
Keywords
Type-1A, 2016:08:01 12:55:40
Type-1A, 2016:08:01 13:52:18
Type-1A, 2016:08:01 18:38:27
Type-1A, 2016:08:01 18:54:11
Type-1A, 2016:08:01 19:16:50
Type-1A, 2016:08:01 19:50:59
Type-1A, 2016:08:01 20:36:55
Type-1A, 2016:08:01 21:48:44
Type-1A, 2016:08:01 22:09:03
Type-1A, 2016:08:01 22:30:42
Type-1A, 2016:08:01 22:47:31
Thank you very much.
Benny