Hi,
with exiftool, I can identify *.NEF (NIKON) files containing the Maker tag "ShootingMode: Single-Frame, Exposure Bracketing". I would like to add this information to the respective, pre-existing *.XMP sidecar files.
Working in batch mode (ExifToolGui) from a folder with:
two *.NEF files without bracketing plus two corresponding *.XMP:
two *.NEF files with bracketing plus two corresponding *.XMP:
-if "$ShootingMode eq 'Single-Frame, Exposure Bracketing'" -keywords+="bracket" @ %d%f.XMP
The output definition seems to be invalid.
Exiftool LOG:
======== ./d70_051030_070.NEF
======== ./d70_051030_071.NEF
6 files failed condition
2 image files updated
0 image files read
2 files could not be read
Error: File not found - @
Error: File not found - %d%f.XMP
<-END-
Identification of the NEF files with bracketing works, but trying to add a keyword (e.g. "bracket") to the pre-existing *.XMP files does not work. Instead, the keyword is written to the *.NEF files (which I do not want to do).
How can I add the keyword to the pre-existing *.XMP files?
Thanks for help!
Guenter
Unfortunately the -if condition applies to the same file that would be written, so you can't use it to do what you want. Also there are some syntax errors with your command, and you should be writing Subject and not Keywords for XMP. Try this:
-tagsfromfile %d%f.NEF -ext xmp "-subject+<${ShootingMode;$_ = $_ eq 'Single-Frame, Exposure Bracketing' ? 'bracket' : undef}" DIR
This uses the advanced formatting feature to test the value and change it on the fly, setting it to undef so nothing is copied if the condition isn't met.
An alternative method is described in note number 4 of the -if option documenation:
4) The condition may only test tags from the file being processed.
To process one file based on tags from another, two steps are
required. For example, to process XMP sidecar files in directory
"DIR" based on tags from the associated NEF:
exiftool -if EXPR -p '$directory/$filename' -ext nef DIR > nef.txt
exiftool -@ nef.txt -srcfile %d%f.xmp ...
- Phil
Phil,
Your code:
-tagsfromfile %d%f.NEF -ext xmp "-subject+<${ShootingMode;$_ = $_ eq 'Single-Frame, Exposure Bracketing' ? 'bracket' : undef}" DIR
does exactly what I want!
Thank you so much!
Guenter