for f in $(ls mydir/*.jpg) do convert -thumbnail $size -quality $quality $f thumbsdir/$(basename $f) done
I'm trying to code a script that takes a directory with images and generates thumbnails from these images. The script runs well, but when it gets to image files that include space characters, it gives me errors, because it thinks it's another file when it meets the space character.
I already tried using quotes such as:
convert -thumbnail $size -quality $quality "$f" "thumbsdir/$(basename $f)"
...but no success.
How could I make this work without having to rename all files and remove space characters?