Copying metadata (location) values to hierarchical keywords

Started by pbb, November 20, 2022, 05:26:00 PM

Previous topic - Next topic

pbb

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?

Phil Harvey

You need to use -addtagsfromfile or the latter assignment overrides the first (this is Note 5 in the -tagsFromFile documentation):

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

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

pbb

Splendid! It never occurred to me that I'd have to use tagsFromFile, so I never got to read that note. Thank you!

Phil Harvey

The redirection notation ("-DSTTAG<SRCTAG") uses -tagsfromfile @ implicitly.

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

StarGeek

Also see FAQ #17 (chrome link), 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.
"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

Phil Harvey

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

StarGeek

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?
"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

Hubert

FWIW your Chrome link does work for me in Safari 16 - takes me to the words 'Note there is a complication'.

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).