for f in /tmp/level*.bmp ; do newname=/tmp/`basename $f .bmp`.png convert $f -geometry 160x120 ${newname} echo "done $newname." done