Hello
Firstly thanks for a great app, exiftool team!
I am trying to reassign location data in a batch script, specifically from the XMP:LocationCreated structure, i.e. for notes, keywords e.t.c.
I know it is possible to read flatten parts such as Sublocation by
exiftool -XMP-iptcExt:LocationCreatedSublocation myfile.jpg
But when trying to assign the Sublocation part to Location in a batch script, i.e.
exiftool -XMP:Location<$XMP-iptcExt:LocationCreatedSublocation myfile.jpg
A warning says that the Tag is undefined.
Command for non structures such as
exiftool -XMP:Location<$XMP:Label myfile.jpg
work fine.
Is is possible to access the subelements directly in a single command in order to do this?
If not, how can the sub-element parts be referenced?
I am using 8.76
Thanks
This is a bit tricky, but is explained in a few places, including the Copying section of the structure documentation (https://exiftool.org/struct.html#Copying).
Tags are copied as structures by default, so --struct must be specified to copy flattened tags. Your command will work if you add this option.
Also, when simply copying a tag value, it is slightly more efficient to drop the "$". (The "$" is needed only when you want to insert a tag value into a string, such as "-copyright<$createdate, Phil Harvey".)
- Phil
Thanks Phil!
"--struct", that was exactly what it was missing!
I managed to get it going with
exiftool --struct -XMP:Location<XMP-iptcExt:LocationCreatedSublocation myfile.jpg
And similar for the other sub-elements.
Cheers for the $ tag tip also!
Xe
Update: As of ExifTool 8.83, you no longer need to use the --struct option to copy flattened tags by name.
- Phil