Author Topic: Recursively dumping image file data to xmp sidecars  (Read 1889 times)

Gary

  • Full Member
  • ***
  • Posts: 48
Recursively dumping image file data to xmp sidecars
« on: November 22, 2015, 06:37:38 PM »
I'm trying the following batch command on files that contain Artist data in the EXIF.

echo ***INFO*** Generating XMP sidecars image files in %1 and its subdirectories >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"
exiftool -ext CR2 -ext NEF -ext JPG -ext TIF -tagsfromfile @ "-C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args" %d%f.xmp -r %1 >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"

This should result in an XMP sidecar, but the message says:

Warning: No writable tags set from C:/Users/Gary Gauthier/Desktop/Raw Images - Copy/Canon EOS 30D/2009-07-18 (Grizzly Day Use Area, Kananaskis Country, AB, CA)/IMG_4572.CR2

It's likely something simple, but I can't see it.
« Last Edit: November 22, 2015, 08:09:53 PM by Gary »

Gary

  • Full Member
  • ***
  • Posts: 48
Re: Recursively dumping image file data to xmp sidecars
« Reply #1 on: November 22, 2015, 09:27:48 PM »
Got It!!!

The documentation is a wee bit ambiguous when it comes to what happens in when recursive commands are used in a batch file.
To create XMP sidecars from existing RAW files, I needed to do the following:

echo ***INFO*** Generating XMP sidecars image files in %1 and its subdirectories
echo ***INFO*** Generating XMP sidecars image files in %1 and its subdirectories >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"
exiftool -ext CR2 -ext NEF -ext JPG -ext TIF -tagsfromfile @ "C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args" "C:\Users\Gary Gauthier\Desktop\arg_files\iptc2xmp.args" "C:\Users\Gary Gauthier\Desktop\arg_files\gps2xmp.args" -o %%d%%f.XMP -r %1 >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"

I believe the documentation says somewhere that the .args files can be relative to the location of the exiftool, so could this could be simplified by putting the .args in the same directory as the exiftool. Shouldn't the reference become something like @ .\exif2xmp.args or even @ exif2xmp.args ?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16702
    • ExifTool Home Page
Re: Recursively dumping image file data to xmp sidecars
« Reply #2 on: November 23, 2015, 07:51:24 AM »
Hi Gary,

Your commands have numerous problems:

Quote
exiftool -ext CR2 -ext NEF -ext JPG -ext TIF -tagsfromfile @ "-C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args" %d%f.xmp -r %1 >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"

You forgot the -@ option before the argfile, and the argfile has an extra "-" before it that it shouldn't.  Also, you forgot the -o option before -o %d%f.xmp.  And if this is in a Windows .BAT file, you need to double the percents in the ExifTool arguments: %%d%%f.xmp

Quote
exiftool -ext CR2 -ext NEF -ext JPG -ext TIF -tagsfromfile @ "C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args" "C:\Users\Gary Gauthier\Desktop\arg_files\iptc2xmp.args" "C:\Users\Gary Gauthier\Desktop\arg_files\gps2xmp.args" -o %%d%%f.XMP -r %1 >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"

The -o problems are fixed, but again your .args files are missing -@ options for each.

And yes, you don't need to specify the directory for the .args files if this is the working directory when running the command.

- Phil

 
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Gary

  • Full Member
  • ***
  • Posts: 48
Re: Recursively dumping image file data to xmp sidecars
« Reply #3 on: November 23, 2015, 11:36:08 AM »
Phil;

I tried taking the code in which you said everything was fixed, except that I needed the "-@" before each of the .args files. I added the "-@" before each .args file to get the following:

Code: [Select]
exiftool -ext CR2 -ext NEF -ext JPG -ext TIF -tagsfromfile -@ "C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args" -@ "C:\Users\Gary Gauthier\Desktop\arg_files\iptc2xmp.args" -@ "C:\Users\Gary Gauthier\Desktop\arg_files\gps2xmp.args" -o %%d%%f.XMP -r %1 >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"

However; it is still giving the following error message:

Code: [Select]
File '-@' does not exist for -tagsFromFile option
It seems to indicate that it thinks that "-@" is a .args file. Did I miss something in what you said?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16702
    • ExifTool Home Page
Re: Recursively dumping image file data to xmp sidecars
« Reply #4 on: November 23, 2015, 12:01:23 PM »
Now you have forgotten the @ argment for -tagsFromFile.  Try this:

exiftool -ext CR2 -ext NEF -ext JPG -ext TIF -tagsfromfile @ -@ "C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args" -@ "C:\Users\Gary Gauthier\Desktop\arg_files\iptc2xmp.args" -@ "C:\Users\Gary Gauthier\Desktop\arg_files\gps2xmp.args" -o %%d%%f.XMP -r %1 >> "C:\Users\Gary Gauthier\Desktop\ExifTool_Logs\Test001.txt"

The options are:
  • -ext CR2
  • -ext NEF
  • -ext JPG
  • -ext TIF
  • -tagsfromfile @
  • -@ "C:\Users\Gary Gauthier\Desktop\arg_files\exif2xmp.args"
  • -@ "C:\Users\Gary Gauthier\Desktop\arg_files\iptc2xmp.args"
  • -@ "C:\Users\Gary Gauthier\Desktop\arg_files\gps2xmp.args"
  • -o %%d%%f.XMP
  • -r

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Gary

  • Full Member
  • ***
  • Posts: 48
Re: Recursively dumping image file data to xmp sidecars
« Reply #5 on: November 23, 2015, 12:05:37 PM »
Ok. Now I understand what you meant. I really hadn't expected to be correct about the initial "@" and missing a subsequent "-@".
I'm so sorry to bother you Phil, but this script is a bit more complex than I've tried in past and this syntax issue eluded me.