#!/bin/bash PHOTODIR="/home/clare/Pictures/pics" SIZE="640x480" echo "Searching ${PHOTODIR} for pictures to resize..." echo 'Files with the prefix of "_" will be resized.' PHOTOLIST=`find $PHOTODIR -iname _\*.jpg -printf "%h%%%f\n"` echo "Beginning resize loop..." for PHOTOFIND in $PHOTOLIST do PHOTODIR=`echo ${PHOTOFIND} | cut -f 1 -d "%"` PHOTOFILE=`echo ${PHOTOFIND} | cut -f 2 -d "%"` OLDPHOTO="${PHOTODIR}/${PHOTOFILE}" NEWPHOTO="${PHOTODIR}/(${SIZE})${PHOTOFILE}" if [ ! -f "${NEWPHOTO}" ] then echo "${OLDPHOTO} -> ${NEWPHOTO}" convert -size ${SIZE} $OLDPHOTO -resize ${SIZE} ${NEWPHOTO} fi done echo "Done resizing images. You may now close this window."