Do not perform any file operation if Tag-Value exists

Started by horst, September 28, 2022, 03:48:39 PM

Previous topic - Next topic

horst

Hi,

this is my first question in this Forum as I couldn't find any answer to my following question on the FAQ, Google, etc.

I like to use Sidecards as *.json and update all JPG's within a folder with the Tags specified in this sidecard. Therefor I exported the Information from an example File with the -json parameter and modified it for my needs. I can now update all files within the current folder by just running

exiftool -r -progress -overwrite_original -json=./sidecard_new.json ./
This is working fine for me, but:

I like to automate the changes. So if I do change the Sidecard file, I want to re-run the operation.

Of course I could just regulary run the command to ensure the files are up to date. But all(!) files are written every time again, even if the Tag already exists and the value is the same.

Is there any way to tell ExifTool to just perform file operations if there are really changes to do?

Otherwise I would have to do some workaround ...

Thanks in advance!
Horst

Phil Harvey

Hi Horst,

The easiest thing to do is to maintain a list of files where you changed the metadata, then use this list in the command instead of updating the entire directory, like this:

exiftool -progress -overwrite_original -json=./sidecard_new.json -@ changed_files.txt

- 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 ($).