Conditionally writing some tags, but others all the time?

Started by mladair, September 02, 2016, 10:31:28 AM

Previous topic - Next topic

mladair

I'm trying to figure out if it is possible to conditionally write one tag, but always write to another tag using one call to Exiftool.

If I am understanding correctly -if expression, will only process the file if the condition is true. My situation is that I need to write to the Maker tag, only if it does not exist, but always write to the DocumentName.

I know I can accomplish this via two separate calls to Exiftool, but I'm trying to avoid that overhead, ie:
exiftool.exe -overwrite_original -ext tif -if "not $make" -make=SomeValue d:\images\folder_with_images
exiftool.exe -overwrite_original -ext tif -DocumentName=SomeDocName d:\images\folder_with_images


Thanks,

-Matt

Phil Harvey

Hi Matt,

The -TAG-=VALUE syntax can be used to conditionally write a tag if it has a specified value.  So the command you want looks something like this:

exiftool.exe -overwrite_original -ext tif -make-= -make=SomeValue -documentname=SomeDocName d:\images\folder_with_images

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