I wrote this script when confronted with giant Maildir directories full of email, most likely spam, usually as a result of unwatched catch-all accounts.

#!/bin/sh
for i in *; do
  if cat $i | spamc | grep "X-Spam-Level: \*\*\*\*" ;
  then
    rm $i
  fi

done

You can configure the threshold at which messages are deleted by adding more \* sequences to taste.

I tend to sort things into folders. The following cron job categorises things saved into my 'saved' folder as ham. I assume that things that I put into more specific folders are either filtered there by procmail, or are from specific people that are on the auto whitelist and never get misclassified.

find /home/joel/Maildir/.saved/cur/ -type f -mtime -1 -print | xargs sa-learn --ham

More notes on my spam strategy are available at MuttMaildirCaching.