I am trying to write a keyword into a .XMP file based on the ARW(sony's raw) EXIF data in the FocusMode field for a specified directory. I found some other examples of this being used but can't seem to get it to quite work.
Can someone help me out here? I would like to add "Manual Focus" or "Auto Focus" as a Keyword. Much appreciated!
To add the FocusMode value directly as an XMP keyword:
exiftool "-subject+<focusmode" DIR
- Phil
Edit: I just checked, and the ARW FocusMode values are "AF-S", "AF-A", "AF-C" or "Manual". To change these to what you indicated, try this:
exiftool "-subject+<${focusmode;s/^A.*/Auto Focus/;s/^M.*/Manual Focus/}" DIR
Hi Phil,
While this does work, it does create an entire new RAW file (saving the original) and changes the creation/modified date/time. Is there a way to write this just to the XMP sidecar? In theory I would like to run this on a directory with a ton of large RAW images.
Thanks again
Ah. I missed that you want to write the sidecar. Try this:
exiftool "-subject+<focusmode" -srcfile %d%f.xmp -ext arw DIR
See here (https://exiftool.org/metafiles.html) for more information about writing sidecar files.
- Phil
Excellent, just what I'm looking for.
Unfortunately, I am now running into the problem I had earlier that caused me to come here thinking my syntax was wrong.
I am geting "File Not Found". I know the usage of single and double quotes are different for mac. But I still think I did this right. Any ideas? The directory is correct, it's dragged and dropped.
exiftool '-subject+<focusmode' -srcfile %d%f.xmp -ext arw '/Volumes/2\ Photo\ Drive/Pictures/2017/12/18/'
File not found: /Volumes/2\ Photo\ Drive/Pictures/2017/12/18/
exiftool "-subject+<focusmode" -srcfile %d%f.xmp -ext arw '/Volumes/2\ Photo\ Drive/Pictures/2017/12/18/'
File not found: /Volumes/2\ Photo\ Drive/Pictures/2017/12/18/
Just drag and drop the folder onto the Terminal window and it will get the quoting right for you.
You either need backslashes to escape the special characters, or quotes, but I don't think you need both.
- Phil
Ahh, didn't need the quotes at all around the directory.
Thanks for all your help, what a wonderful tool.