If and tags/keywords ?

Started by juju22, October 24, 2011, 08:17:46 AM

Previous topic - Next topic

juju22

Hello,

I want to use exiftool to detect file with some tags (either XMP:Tags list, XMP-dc:Subject, either IPTC:Keywords)

exiftool -p '$directory/$filename' -if '($rating and $rating>=1 and $tags=famille)' -r *.JPG

first, this command does not work
second, how can I say "contains" in the case has multiple keywords ?

Phil Harvey

First of all, it sounds like you want to use the XMP digiKam "TagsList" tag (not "Tags").

Here is the command that matches "famille" inside the list:

exiftool -p '$directory/$filename' -if '($rating and $rating>=1 and $tagslist=~/famille/' *.JPG

The quoting above is for Mac/Linux.  Linux uses a case-sensitive filesystem, so you will only get .JPG files and not .jpg files with this command.  It is better to do this to avoid case sensitivity issues:

exiftool -p '$directory/$filename' -if '($rating and $rating>=1 and $tagslist=~/famille/' -ext jpg .

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

juju22


yeah, That's it. Exactly what I wanted.

Thanks a lot Phil.

juju22


while thinking about this, I thought about 2 extra things to improve:

- is there a way to group multiple if in one exiftool call ?
for now, I'm doing
exiftool -p '$directory/$filename' -if '($rating and $rating>=1 and $tagslist=~/famille1/)' -r -ext jpg . | rsync -q --files-from=- ./ $palbum_tmp-famille1/
and I repeat for multiple tag, for example three times.
Is there a way to have only one parsing of images by exiftool instead of 3 ? something like:

exiftool -p '$directory/$filename' -if '($rating and $rating>=1 and $tagslist=~/famille1/) do shell(rsync ... to-famille1); ($rating and $rating>=1 and $tagslist=~/famille2/) do shell(rsync ... to-famille2);' -r -ext jpg .

- second question is there a keyword to search all meta tags ? something like sql fulltext search ? just in case, there is a specific app using non-classical tag name.


Thanks a lot.



Phil Harvey

It would be more efficient to do what you want in a shell script:  Just extract the keywords for each file and use awk to check for matches on the return value.  Currently the exiftool -if option is only go or no-go -- it doesn't support multiple outcomes.

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

juju22