I am trying to find all photos that are not equal to a 256 pixels in height and length and move them to a new folder. So far I was able to write up the following code in the terminal that outputs in to the terminal a list of all the photos that math the criteria:
find . -iname "*.jpg" -type f | xargs -I{} identify -format '%w %h %i' {} | awk '$1!=256 || $2!=256'
Now I wish to move all of these photos to a new folder. I tried the following:
find . -iname "*.jpg" -type f | xargs -I{} identify -format '%w %h %i' {} | awk '$1<300 || $2<300' -exec mv "{}" ~/path_to_location/ \;
I am getting an error that there is
no such file or directory named exec
and also:
xargs identidy: terminated by signal 13
Would love your help Thanks
-exec
is seen as an argument to yourawk
command, and of course,awk
does not know what to do with that. – vanadium Aug 17 '22 at 10:49