Author Topic: Altering keywords  (Read 1422 times)


  • Newbie
  • *
  • Posts: 2
Altering keywords
« on: February 18, 2014, 11:43:06 PM »
First off... this tool is excellent.  It has made my life so much easier in just the last couple of days I have been using it.  Thanks for developing it.

Now to the question / scenario.

I am migrating from Windows Live Photo Gallery to Adobe Lightroom.  The challenge I have is that I have tagged all of my photos in WLPG and would like to bring that information over to LR.  The challenge is that LR and WLPG handle hierarchical tags differently.  In WLPG a tag hierarchy is delimited by a "/".  In LR a tag hierarchy is delimited by a "|".

What I was planning on doing was replacing all of the "/" with "|" in the keyword metadata.  Here is how I was planning on doing this.
1. Export all of the keyword metadata for my files into a CSV.  Here's the command I have for that.

exiftool -csv -r -filename -IFD0:XPKeywords -XMP-dc:Subject -XMP-microsoft:LastKeywordXMP images_folder > temp.csv

2. I would then search and replace all of the "/" with "|" in the appropriate columns temp.csv file.
3. I would then use the altered csv file to update all of the image files' keyword data

exiftool -r -csv=temp.csv -overwrite_original -P images_folder

This appears to work but introduces an extra keyword containing all of the keyword concatenated together.  I have attached a zip file showing the issue.

Any help with this would be greatly appreciated.



  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3803
Re: Altering keywords
« Reply #1 on: February 19, 2014, 03:52:50 AM »
You might want to test it yourself, but it doesn't appear that Lightroom (at least, not LR4) reads the -IFD0:XPKeywords and -XMP-microsoft:LastKeywordXMP tags.  I took your before test image, removed the subject tag, and nothing showed up in keywords at all.

Now, one possible way to convert the subject tags would be something like this:
ExifTool -sep ", " "-Subject<${Subject;tr(/)(|)}"  <DIR/FILES>

This will treat the Subject as a single string separated by "CommaSpace", use the perl command tr to translate / into |, then split the line back individual keywords at the "CommaSpace" mark.  This will assume that at no time you have "CommaSpace" actually in a keyword.  If so, change the characters in the quotes after -sep to something unique.

Also, you might want to look to the HierarchicalSubject tag which appears to be what LightRoom actually looks for in this case.  That command might look like this:
ExifTool -sep ", " "-Subject<${Subject;tr(/)(|)}" "-HierarchicalSubject<${Subject;tr(/)(|)}" <DIR/FILES>

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.


  • Newbie
  • *
  • Posts: 2
Re: Altering keywords
« Reply #2 on: February 19, 2014, 03:02:57 PM »
Thanks.  This did exactly what I needed.