+function generate_thumbs() {
+ $ECHOCOMMAND "Generating Thumbnails"
+ currentimage=0
+ totalimages=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | $WCCOMMAND);
+ imagestoupdate=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | while read filename; do filename=${filename//\"/\\\"}; if [ ! -r "icons/$filename" ] || [ "$filename" -nt "icons/$filename" ] || [ $($IDENTIFYCOMMAND -format "%w" "icons/$filename") -ne $WIDTH ]; then $ECHOCOMMAND $filename; fi; done | $WCCOMMAND)
+
+ if [ $totalimages -eq $imagestoupdate ]; then
+ $ECHOCOMMAND "Regenerating all thumbnails"
+ elif [ $imagestoupdate -eq 0 ]; then
+ $ECHOCOMMAND "No Updated Thumbs, not regenerating"
+ return
+ else
+ $ECHOCOMMAND "Generating $imagestoupdate of $totalimages thumbnails"
+ fi
+
+ $FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $ECHOCOMMAND {} | while read filename; do tempfilename=${filename//\"/\\\"/}; if [ ! -r "icons/$tempfilename" ] || [ "$tempfilename" -nt "icons/$tempfilename" ] || [ $($IDENTIFYCOMMAND -format "%w" "icons/$filename") -ne $WIDTH ]; then $ECHOCOMMAND -n $filename; $ECHOCOMMAND -n -e "\000"; fi; done | $XARGSCOMMAND -0 --verbose --max-procs=4 --replace $CONVERTTOOL -resize $WIDTH '{}' 'icons/{}' 2>&1 | while read throwout; do $ECHOCOMMAND done: $currentimage/$imagestoupdate images; currentimage=$((currentimage+1)); done
+ $ECHOCOMMAND done: $imagestoupdate/$imagestoupdate images
+ $ECHOCOMMAND "Completed generating thumbs for $totalimages images"
+}
+