Hi,
I have this command in a bash script:
exiftool -P -p '$directory/$filename' -srcfile %d%f.%e -@ sourcefile.txt -if '$XMP-dc:Creator ne $xmp-acdsee:Author' > list.txt
It works fine as long as XMP-dc:Creator is not empty. In that case, if it is not equivalent to xmp-acdsee:Author, then the file will be listed in list.txt
My problem is when XMP-dc:Creator is empty. Even if it is not equivalent to xmp-acdsee:Author, it seems that the file will not be listed in list.txt
What would the solution/workaround to deal with empty tags?
Thanks.
I'm assuming Mac/Linux?
The -if :$XMP-dc:Creator ne $xmp-acdsee:Author" works correctly here on Windows, but I recall a similar difference a long time ago but having to do with undefined numbers.
Try -if '$XMP-dc:Creator ne $xmp-acdsee:Author or not defined $XMP-dc:Creator'
Thanks for the follow-up
Yes, I'm on Linux.
Following your suggestion, I assume that if XMP-dc:Creator is empty (not defined), the condition will be met and then the file will be listed in list.txt?
Actually, if XMP-dc:Creator is empty (not defined), I would like that the file be listed in list.txt only if xmp-acdsee:Author is also empty (not defined).
Could I use some combinaison of or/and (I looked to find some info on using or/and but found nothing... Though terms to search since these are so common words!).
Try
-if '$XMP-dc:Creator ne $xmp-acdsee:Author or not (defined $XMP-dc:Creator and defined $xmp-acdsee:Author)'
OK, I'll try it.
Could you point me where I could find the documentation on how to use operators and/or with -if?
Thanks again.
Here is the ExifTool -if option documentation (https://exiftool.org/exiftool_pod.html#if-NUM-EXPR), and here is the Perl operator documentation (https://perldoc.perl.org/perlop.html).
- Phil