News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Using $filename in thumbnail path

Started by snorb, March 11, 2019, 04:16:03 PM

Previous topic - Next topic

snorb

Hello all,

I'm trying to write thumbnails to a set of images and using the filename as part of the thumbnail path but I'm not having much joy.

I'm using a batch file on Windows, with the images in a subdirectory and the thumbnails also in a subdirectory. The thumbnails have the same name as the images.

The following fails with the error "Error opening file thumbnails/$filename".

exiftool "-ThumbnailImage<=thumbnails/$filename" "photos/*.jpg"


Testing with single image, and hardcoding the file names, as below, works OK, so it doesn't seem to a path issue.

exiftool "-ThumbnailImage<=thumbnails/aaa.jpg" "photos/aaa.jpg"


Any suggestions for what I'm doing wrong?

Thanks,

Stephen

Windows 10
ExifTool 11.2.9.0

StarGeek

The answer lies in the error response.  Exiftool is trying to open thumbnails/$filename, not thumbnails/aaa.jpg.  That tells you that it's not reading $filename as a tag, but as static string.

If you read the docs for the -TAG<=DATFILE option, you'll see that it gives the %code variables for filename, directory, etc, and doesn't mention using tags at all. 

Try
exiftool "-ThumbnailImage<=thumbnails/%F" "photos/*.jpg"
* 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).

snorb

I have to confess, I completely overlooked the -TAG<=DATFILE option.

It's working a treat (I just had to escape the %, as it's a Windows batch file).

Thanks.