for f in `find . -type f -iname "*.jpg"` do convert ./"$f" -resize 400\> ./"${f%.jpg}_thumb.jpg" mv ./"${f%.jpg}_thumb.jpg" /home/user/thumbs/ done