The problem is not really the exiftool command: rather that I have been
trying various combinations of exif data to create hierarchical keywords
I am using
exiftool -csv=test.csv .
with one image, and various contents of the HierarchicalSubject of the
csv file. I check what I have created using
exiftool IMG_0016.JPG | less
I added keywords within Lightroom and saved the metadata to see what it
wrote: it seemed to be HierarchicalSubject, Subject and Keywords. But I
seem to need just HierarchicalSubject when I import.
If I define keywords Big and small within Big, and create
then on import I get the hierarchical keyword OK. But if I try to also
set up Big2|small2, by using
I get a single keyword small2 nested in "small, Big2", nested in Big.
I think you're encountered two issues that aren't very well documented:
- You need to set the Subject field, not HierarchicalSubject, with the keywords of the form "Big|Small" and leave HierarchicalSubject blank. LR will properly interpret on import the "|" character in the Subject field. (LR will only interpret "Big|Small" in HierarchicalSubject if Subject also contains "Big, Small".)
- You need to provide the -sep option to Exiftool when reading a CSV file:
exiftool -csv=test.csv -sep=", " test.jpg
Note that there is a space after the comma. The Exiftool command-line documentation says that is the default for the -sep option, but it doen't appear to be the case.
Very many thanks. I used -sep ", " (without the =) and it worked.
It seems to work with either the HierarchicalSubject or the Subject
field set in my tests, but
-sep ", " with a space was necessary because I had a space in my csv
file. Without this space I needed -sep "," rather than -sep ", ".
My problem was that I did not understand the significance of the + in
string+ in the exiftool description of the Subject tag. And I did not
ask for a binary display, so I could not distinguish between one or two
exiftool -Subject -b test.jpg
shows it quite clearly.
BTW I think -sep is necessary for csv file input but not when list data
are entered from the command line. But the help is not very clear.
John R. Ellis wrote:
The Exiftool command-line documentation says that is the default for the -sep option, but it doen't appear to be the case.
The documentation states that ", " is the default for reading. The default for writing is to not split the value, but I admit this isn't perfectly clear.