I have inherited a large group of files. Some of them have keywords like 20's or 80's... when I try to replace the single quotation mark I get an error message
exiftool "-keywords<${keywords;tr/"'"//d}"
Quote from: E_Rap on March 22, 2022, 02:27:37 PMexiftool "-keywords<${keywords;tr/"'"//d}"
Be careful with this, it makes Common Mistake #5b (https://exiftool.org/mistakes.html#M5).
Adding a leading "$" when copying a simple tag ... Also, values of list-type and shortcut tags are concatenated in the string rather than being copied individually
So this command would combine all keywords into a single keyword.
Try this
exiftool -api "Filter=s/'//g" -TagsFromFile @ -Keywords -Subject /path/to/files/This uses the
-api Filter option (https://exiftool.org/ExifTool.html#Filter) to use regex to remove single quotes. It affects each keywords separately.
I have tried running this a few times but it does not eliminate the single quote. Any other suggestions?
exiftool -api "Filter=s/'//g" -TagsFromFile @ -Keywords -Subject /path/to/files/
I'm on Mac, but StarGeek's command should work on any system:
> exiftool a.jpg -keywords
Keywords : Phil's, test
> exiftool a.jpg -api "Filter=s/'//g" -TagsFromFile @ -Keywords -Subject
1 image files updated
> exiftool a.jpg -keywords
Keywords : Phils, test
- Phil
Run this command and copy/paste the output here
exiftool -G1 -a -s -Subject -Keywords file.jpg
First thank you for all the help received so far, this forum is really great!
I am still trying to remove single quotes from keywords:
using a Windows 10 x64 workstation
using exiftool ver 12.28
From Adobe Bridge the view looks like this:
1) Before any exiftool commands are run (Single Quote 1.jpg) screenshot
2) After using exiftool with the following command, exiftool -api "Filter=s/'//g" -TagsFromFile @ -Keywords -Subject -overwrite_original "Path\File" (please see Single Quote -2.jpg
3) After using exiftool with the following command, exiftool -G1 -a -s -Subject -Keywords "Path\File" (please see Single Quote - 3.jpg)
4) View from Command Prompt after both options have been tried (Please see Single Quote -4.jpg)
Those aren't single quotes ', those are fancy/curly quotes '.
This may take a few tries to get right since Windows doesn't deal well with fancy quotes on the command line, as you can see from the exiftool output. First, you'll want to change the command lines code page as per FAQ #18 (https://exiftool.org/faq.html#Q18).
The try
exiftool -api "Filter=s/'//g" -TagsFromFile @ -Keywords -Subject /path/to/files/
Hopefully, that will work. If not, try adding the -L (latin) option (https://exiftool.org/exiftool_pod.html#L--latin).
You may have to copy/paste the quote from Bridge as it may not be the exact quote mark I used here. I believe there might be a couple variations.
... or you could remove all non-ascii characters like this:
exiftool api "Filter=s/[^ -~]//g" -TagsFromFile @ -Keywords -Subject /path/to/files/
- Phil
It worked perfectly! Thank you!!