I am trying to reorganise images based on the species that is within an image. Among other information, the species name can be found in the IPTC metadata (see link to the Inspector image). I am attempting to do this in bash on macOS and have tried following code (with template species name and directory):
find . -iname "*.jpg" -print0 | xargs -0 grep -l "Species Name" | xargs -0 -I {} mv {} ~/example/directory
I have also tried using the exiftool
package, where the relevant information is in the Subject tag:
find . -iname "*.jpg" -print0 | xargs -0 exiftool -Subject | grep "Species Name" | xargs -0 -I {} mv {} ~/example/directory
However, I receive following error message, which I assume to be a result of a misuse of grep
or the last xargs
:
mv: rename (standard input)
to ~/example/directory(standard input)
: No such file or directory
Any ideas what could fix this issue? Thank you in advance.