I have a dates.xml file containing ExifIFD:CreateDate tag information for multiple files:
...
<rdf:Description rdf:about='IMG_0226.jpg'
xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 12.22'
xmlns:ExifIFD='http://ns.exiftool.ca/EXIF/ExifIFD/1.0/'>
<ExifIFD:CreateDate>2002:09:12 00:00:00+02:00</ExifIFD:CreateDate>
</rdf:Description>
<rdf:Description rdf:about='IMG_0227.JPG'
xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 12.22'
xmlns:ExifIFD='http://ns.exiftool.ca/EXIF/ExifIFD/1.0/'>
<ExifIFD:CreateDate>2002:09:12 00:01:00+02:00</ExifIFD:CreateDate>
</rdf:Description>
...
My hope was, -tagsfromfile would consider the rdf:about attribute for the assignment, but it does not. At least
exiftool.exe -tagsfromfile dates.xml *.jpg
just takes the first ExifIFD:CreateDate tag entry from the .xml and adds it to all files. How can I make it add the correspoding entry from the file to each .jpg?
Unfortunately the -X (XML) output may not currently be used to input a database for multiple files. For this, you must use -json or -csv.
- Phil
Many thanks for the quick reply.
But no luck with -json.
I tried to import from
[{
"SourceFile": "IMG_0226.jpg",
"ExifIFD:CreateDate": "2002:09:12 00:00:00+02:00"
},
{
"SourceFile": "IMG_0227.jpg",
"ExifIFD:CreateDate": "2002:09:12 00:01:00+02:00"
},
...
with
exiftool.exe -tagsfromfile exifall.json *.jpg
but now I get the Warning: No writable tags set from exifall.json. I tried omitting/changing the group name, tags that definitely exist in the files, -addtagsfromfile, ..., but got allways the same.
The json file was created using
exiftool.exe -json -file:filemodifydate *.jpg > exifall.json
and then I modified the tag entries.
Any hint?
You need to use the -j (-json) option (https://exiftool.org/exiftool_pod.html#j-JSONFILE--json) to rewrite the data.
exiftool.exe -j=exifall.json -ext jpg .
Also, see Common Mistake #2 (https://exiftool.org/mistakes.html#M2) for the pitfalls of using wildcard filenames. It's better to use a dot to indicate the current directory and the -ext (-extension) option (https://exiftool.org/exiftool_pod.html#ext-EXT---ext-EXT--extension) to limit the scope.
Thanks, StarGeek. Right, actually I had to use
exiftool.exe -json="exifall.json" -ext jpg .
This finally worked.
One note: Before this worked, however, an encoding problem popped up:
The json file was created using
exiftool.exe -json -file:filemodifydate *.jpg > exifall.json
With this file used as input file, exiftool complained about a Format error in JSON file 'JSON file'. In Notepad++ the encoding was named UCS-2 LE-BOM. Only after changing the encoding to UTF-8 or ANSI, the file was accepted by exiftool. ExifToolVersion is 12.22.