#!/usr/local/bin/bash spamlearn=/usr/local/bin/sa-learn LearnDirs=`find /home/vpopmail/domains/ -name .Spam -type d` for dir in $LearnDirs; do $spamlearn --spam $dir/cur > /dev/null $spamlearn --spam $dir/new > /dev/null # the rm lines are optional /bin/ls $dir/cur/* | /usr/bin/xargs /bin/rm -f /bin/ls $dir/new/* | /usr/bin/xargs /bin/rm -f done $spamlearn --sync