I would like to loop through some directories with pictures and copy (and after reviewing remove) them to another directory based on image dimensions, let's say smaller than 800x600.
I've tried a query like
find . -iname "*.jpg" -type f -exec identify -format '%w %h %i' '{}' \; | awk '$1<800 || $2<600
but I get no results, but I'm certain that there are smaller pictures.
Can anyone give me a hint? Thanks!
'%w %h %i\n'
? I think your entire output may get concatenated to one single line at the moment because the format doesn't specify that a new-line is to be printed at end-of-record, and if the very first picture found doesn't happen to be smaller than 800x600, the entire output will be discarded byawk
. – AdminBee Mar 10 '20 at 13:00awk '$1<800 && $2<600'
? – AdminBee Mar 10 '20 at 13:02