Flattening Tag Hierarchy

Started by jtboldon, October 29, 2021, 12:08:41 PM

Previous topic - Next topic

jtboldon

Hello,
I have been using Windows Live Photo Gallery for years but it is now time to move on. I have been using a keyword hierarchy which looks like this - Places/England/Dorset/Swanage/Swanage Railway and simpler ones like - Pub/Nelson  It did seem a good idea at the time???
Could someone please give me an idea as to a command for Exiftool which flattens my hierarchy such that a photo with those two hierarchic tags would now have separate keywords
Places, England, Dorset, Swanage, Swanage Railway, Pub, Nelson
Thanks in advance
jtb

StarGeek

First you need check to see where the keywords are held.  Run the command in FAQ #3 to find them.  Odds are they are located in Subject and/or Keywords.

You could then run a command like this
exiftool -api "Filter=s(/)(, )g" -sep ", " -TagsFromFile @ -Subject -Keywords /path/to/files/

The -api Filter will convert all the slashes into (comma)(space).  The -sep option then tells exiftool to separate lists type tags on (comma)(space).  The rest then copies the Subject and Keywords tags back into the file, now as separated keywords.

One thing to be careful of is if any of your keywords already included a comma, as it will separate on those as well.  For example, if you had the keyword of "Smith, John", this would make two keywords, "Smith" and "John".

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

jtboldon

Thank you so much!!!
Cheers,
John