Hi,
May I know how am do swap %20 with a space in metadata, I assuming this can only be done using the Config file. Any example code please?
As a quick test, presuming that the keyword/subject metadata contained multiple %20 characters that needed to be changed to word spaces, the following regex appears to work (no special config file was used):
exiftool -subject'<${subject;s/(%20)/ /g}' FILE_or_FOLDER
This would work fine with a normal string type tag, but in the case of a list type tag such as Subject or Keywords, it will convert the all the entries in the list into a single entry unless the -sep option is also used.
I prefer the -api filter option with -TagsFromFile, as processes each item in a list type tag separately. (I'm far too attached to that option.)
exiftool -api "Filter=s/%20/ /g" -TagsFromFile @ -TAG -TAG2 -TAG3 FileOrDir
Replace each TAG with the tag you actually want to run the substitution on. Replace FileOrDir with the files and/or directories that you want to process.
Ah, you are of course 100% correct StarGeek, I should have tested with more than one keyword (I don't know how many times that this list tag issue has caught me out)!
So, presuming that a semi-colon ; separator was consistently used to separate the list keywords:
exiftool -sep ';' -subject'<${subject;s/(%20)/ /g}' FILE_or_FOLDER
I of course prefer your more elegant solution, at least I had the regex bit mostly right (I used a capture group, even though I was not back-referencing it in the replace).
Thanks Stephen & StarGeek,
This line of code is what I was looking for:
$item =~ s/(%20)/ /g;