I want a bash script which does the following:
- Find pictures (jpg,jpeg,JPG,JPEG) recursively from current directory downwards
- Generate a thumbnail with imagemagick's convert
- Move thumbnail to other directory
My current script looks like this:
for f in `find . -type f -iname "*.jpg"`
do
convert ./"$f" -resize 800x800\> ./"${f%.jpg}_thumb.jpg"
mv ./"${f%.jpg}_thumb.jpg" /home/user/thumbs/
done
It doesn't convert files (or folders with all content) which have spaces/special characters. I tried with print0
but it didn't help.
find
's output