ExifTool Forum

General => Metadata => Topic started by: pbb on November 20, 2022, 05:26:00 PM

Title: Copying metadata (location) values to hierarchical keywords
Post by: pbb on November 20, 2022, 05:26:00 PM
I am trying to create hierarchical keywords of some of the existing image metadata, starting with the locations fields. For an example image with metadata values "My Country" and "My City" for the corresponding fields, I would like add keywords "Shooting location|My Country" and "Shooting location|My Country|My City".

But when running the command
exiftool -"HierarchicalSubject+<Shooting location|$Country" -"HierarchicalSubject+<Shooting location|$Country|$City" image.jpg


Then only the "Shooting location|My Country|My City" keyword is added.

My guess is I'm just having a minor error with placement of operating characters, or am I misunderstanding something?
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: Phil Harvey on November 20, 2022, 09:06:59 PM
You need to use -addtagsfromfile or the latter assignment overrides the first (this is Note 5 in the -tagsFromFile documentation (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT)):

exiftool -addtagsfromfile @ -"HierarchicalSubject+<Shooting location|$Country" -"HierarchicalSubject+<Shooting location|$Country|$City" image.jpg

- Phil
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: pbb on November 21, 2022, 03:05:01 PM
Splendid! It never occurred to me that I'd have to use tagsFromFile, so I never got to read that note. Thank you!
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: Phil Harvey on November 21, 2022, 08:37:24 PM
The redirection notation ("-DSTTAG<SRCTAG") uses -tagsfromfile @ implicitly.

- Phil
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: StarGeek on November 22, 2022, 03:20:21 PM
Also see FAQ #17 (https://exiftool.org/faq.html#Q17) (chrome link (https://exiftool.org/faq.html#Q17:~:text=Note%20there%20is%20a%20complication)), paragraph starting "Note there is a complication"

Testing out Chrome's ability to directly link to test. Works in Chrome and MS Edge, probably any Chromium based browser.  Doesn't work in my old version of Firefox, but this is obviously off topic so I'll shut up now.
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: Phil Harvey on November 22, 2022, 09:10:22 PM
Chrome link doesn't work in Safari 14.0.3

- Phil
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: StarGeek on November 24, 2022, 06:33:39 PM
Quote from: Phil Harvey on November 22, 2022, 09:10:22 PMChrome link doesn't work in Safari 14.0.3

Then I probably won't bother.  One question, did the chrome link at least take you to FAQ #17?
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: Hubert on November 25, 2022, 01:59:35 AM
FWIW your Chrome link does work for me in Safari 16 - takes me to the words 'Note there is a complication'.
Title: Re: Copying metadata (location) values to hierarchical keywords
Post by: Phil Harvey on November 25, 2022, 08:17:54 AM
Quote from: StarGeek on November 24, 2022, 06:33:39 PMdid the chrome link at least take you to FAQ #17?

It took me to the top of the FAQ page.

- Phil