Author Topic: Command to remove quotes from around keywords?  (Read 392 times)

emjaysea

  • Newbie
  • *
  • Posts: 8
Command to remove quotes from around keywords?
« on: May 11, 2020, 09:53:06 AM »
I've been using a now discontinued image server app, Gallery Server Pro, to host my images and to tag them, too, but I find that it's put quotes around the keywords, like this: "lake, Lake Michigan, swimming, fun, recreation, kids, summer day"  When I try to import the images into the new app I'm using, it only gets about the first four keywords and ignores the rest, unless I remove the quotes, then it sees them all and imports them.  I'm hopeful that someone will help me come up with a simple command line I can use in ExifGUI to remove all those quote marks before I import them into the new app.  Thanks for your assistance.

emjaysea

  • Newbie
  • *
  • Posts: 8
Re: Command to remove quotes from around keywords?
« Reply #1 on: May 11, 2020, 10:16:35 AM »
Hey, I see that ExifGUI is no longer supported, sorry for asking this here, then, although to use the EXIFTool Direct option in the GUI, I believe you're just entering command line type commands. 

Having said that, I poked around some more and found this: "-keywords<$subject" -sep "//"  That seems to work!  Except it adds an extra space between the keywords as viewed from Adobe Bridge.  Is the extra space a big deal?  To be clear, the extra space is at the beginning of the keyword, so in Bridge it looks like this:  lake;  Lake Michigan;  swim;  fun;  recreation,  Bridge adds the semi-colons, not me, and ExifTool GUI displays the keywords like this: aspen* harvest* timber* lumber* forest* forestry* woods* trees* fall* autumn
« Last Edit: May 11, 2020, 11:06:22 AM by emjaysea »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17020
    • ExifTool Home Page
Re: Command to remove quotes from around keywords?
« Reply #2 on: May 11, 2020, 11:05:20 AM »
I don't see how the command you gave solves your problem.  All it does is copy the XMP:Subject to IPTC:Keywords.  And it would be better to do it like this: "-keywords<subject" (see common mistake 5b)

But if the keywords are stored in XMP:Subject as a single string with ", " separating the words, then they can be split apart like this:  -tagsfromfile @ -subject -sep ", "

I can help more if you post an example of the file which gives the quotes around the keywords.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

emjaysea

  • Newbie
  • *
  • Posts: 8
Re: Command to remove quotes from around keywords?
« Reply #3 on: May 11, 2020, 11:16:26 AM »
http://dnrmedia.org/misc/DSK161-01.jpg 

Thanks, I really appreciate it.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 4066
Re: Command to remove quotes from around keywords?
« Reply #4 on: May 11, 2020, 11:57:39 AM »
It looks like the main problem is that the keywords are not stored separately but as a single string. So in the example image, there is a single keyword consisting of
aspen, trees, forest, woods, forestry, late fall
instead of a list of individual keywords
aspen
trees
forest
woods
forestry
late fall


What you'll want to use in the GUI direct would be
-tagsfromfile @ -Keywords "-subject<Keywords" -sep ", "

This will correct the Keywords error and copy Keywords into Subject.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

emjaysea

  • Newbie
  • *
  • Posts: 8
Re: Command to remove quotes from around keywords?
« Reply #5 on: May 11, 2020, 12:33:10 PM »
Awesome, thanks!  Now how do I apply it to tens of thousands of files in hundreds of directories?  I'm guessing I'll have to use command line for that...

Really appreciate it, it appears to work perfectly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17020
    • ExifTool Home Page
Re: Command to remove quotes from around keywords?
« Reply #6 on: May 11, 2020, 01:04:28 PM »
On the command line:

exiftool -tagsfromfile @ -Keywords "-subject<Keywords" -sep ", " -r DIR

but instead of typing the directory name (represented by "DIR" in the above command), you can drag and drop the folder onto the cmd.exe window.

Also, the above command will leave "_original" files for each changed file as a backup.  Add -overwrite_original to the command if you already have backups.

And add -P to the command if you want to preserve the original filesystem modification time of each file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

emjaysea

  • Newbie
  • *
  • Posts: 8
Re: Command to remove quotes from around keywords?
« Reply #7 on: May 13, 2020, 09:33:30 AM »
Thank you, Phil, that works great, too.  This will literally save me a week of work, if not more.

emjaysea

  • Newbie
  • *
  • Posts: 8
Re: Command to remove quotes from around keywords?
« Reply #8 on: May 13, 2020, 09:36:57 AM »
And I should add for anyone reading this in the future, the quotes I was seeing was Adobe Bridge's interpretation of, "this series of words separated by commas is really just one keyword", which is what StarGeek helpfully pointed out.  When looking at the keywords in ExifToolGUI, there were no quotes.