Working with variables in an exiftool call

Started by philbond87, January 22, 2021, 08:39:51 PM

Previous topic - Next topic

philbond87

I have an application that iterates through a directory of DNG files and makes individual exiftool calls to extract an embedded image and save it out as a JPG file, with the same root filename as the DNG.

"usr/local/bin/exiftool -b -PreviewImage " + dng.shellPath + " >" + destinationFolder.shellPath + "/" + filename
(I construct the destination filename in code)

This works great but I suspect it would be significantly faster if I could make one exiftool call on the entire directory, but I don't know how I can construct a the proper filename for each file the exiftool call will encounter in the directory.

How would this be done?

StarGeek

This example in the docs would be a good place to start.  It uses the -W (-TagOut) option to extract all the preview images in the file, writing each to a separate file.  The various percent tokens detailed in the -w (-TextOut) option can be used to give you some control over the output filename if it's based upon the original filename in any way.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

philbond87

@StarGeek
Brilliant. Tremendously helpful.
Thank you!