What is better to do write to a tag or use exiftool -if 'not $TagName.
I am looking to only update images that do not have tag filed in and or do not match tag value.
and combine 2 tag in one script
artist and ModifyDate
You can't use use the -if option (https://exiftool.org/exiftool_pod.html#if-NUM-EXPR) to conditionally write one tag and unconditionally write another.
But if you're writing the same thing to artist that already exists and you're writing new value for ModifyDate for all file, just write both at the same time. For example, if half your files already have Artist set to "me" but you're going to change the ModifyDate on all the files anyway, go ahead an rewrite Artist, e.g. -Artist=Me -ModifyDate="2021:11:04 12:00:00". That would be faster than running two separate commands.
This is what I tryed
exiftool -r -overwrite_original -artist="$Artist" -ModifyDate=now $path
what about using if vs just over wring command?
That's the same question I just answered.
would this work
to add a Tag if no tag data is found
exiftool -if "not $ModifyDate" -ModifyDate=now
Test it to see if it's what you want.
when I run it I get 1 files failed condition
On Mac/Linux, you use single quotes around anything with a dollar sign, otherwise the shell/terminal treats it as a shell variable.
This is what I am running
I am combing to it with adding Artist tag
exiftool -r -overwrite_original -if "not defined $ModifyDate" -ModifyDate=now -artist="$Artist" "$path"
What system are you running? It seems as if you are using Unix shell variables for $Artist and $path. If in a Unix shell, you need to do this as StarGeek said:
exiftool -r -overwrite_original -if 'not defined $ModifyDate' -ModifyDate=now -artist="$Artist" "$path"
- Phil
I am running the script on OS X
When I run it I get the error Error: Not a valid TIFF (looks more like a MacOS)
Then when I check the files they have ModifyDate, Artist
You're running the command on a MacOS resource file if you're getting that error.
- Phil
This is what I am running
exiftool -r -overwrite_original -if 'not defined $ModifyDate' -ModifyDate=now -artist="$Artist" "$path"
and there is just tiff in my folder
Is "$path" the directory name? If so, you are probably running ExifTool on 2 files. A TIFF file and the hidden MacOS file. Use -i HIDDEN to ignore hidden files.
- Phil
I am also trying to add tag data if it is missing or there is no data in the field. for example is made does not exist
-if $make =~ ""