1

I want to find all .jpg files in my directory that contain a specific tag and copy them to a different directory. In particular, I am using GThumb which allows me to put tags to my photos - it stores them as a list under Keywords: exiftool -Keywords IMG_0205.JPG outputs Keywords : winter, nice_photos, my_anther_tag. And I want to find all images containing the tag "winter" and copy them to another directory. However, I found no way how to specify that I want to list file names of only those images containing the tag "winter". I tried also to use jhead, but having the same problem, or combine it with grep and then sed but it seems too complicated (as I even don't know how to at least list the file name in the same line as Keyword: winter,...).

Do you have any advice on how to do it?

0

It's a SMOP (Simple Matter Of Programming).

Use find and xargs (Read man find xargs) to pass a list of all the .jpg files to a bash script.

In the script, step through the list of files with the

while [[ $# -gt 0 ]] ; do
    file="$1"
    shift
    ...
    do something with "$file"
    ...
done

construction.

In the "do something with "$file"" part, use exiftool to extract the property you want, test it, and move (or not) "$file", or just printf the names of qualified files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.