I am doing something ugly as: (The directory moves are because I sometimes get special directories underneath 'new', which is ehm ' interesting', together with DA we replaced a bit of code that delivers spam into /new/, now everything works fine, but I still check for it.
websrv01# cat ~remko/scripts/learnspam.sh
#!/bin/sh
HOMEDIR="/home/remko/Maildir/.INBOX.spam"
SPAMDIR="/home/remko/Maildir/.INBOX.spam/cur"
DIRLIST=`/usr/bin/find ${HOMEDIR}/cur -type d`
DIRLIST2=`/usr/bin/find ${HOMEDIR}/new -type d`
# Do an inventory for all possible directories that we need to move
# around, because they should not be there. After that learn the spam
# contents of those directories.
for DIR in ${DIRLIST}
do
if [ "${DIR}" = "/home/remko/Maildir/.INBOX.spam/cur" ]
then
/bin/echo "Current dir is cur: ${DIR}" > /dev/null 2>&1
else
/bin/echo "Something weird found under: ${DIR}"
/bin/mv ${DIR}/* /home/remko/Maildir/.INBOX.spam/new
/bin/rmdir ${DIR}
fi
done
#for DIR2 in ${DIRLIST}
#do
# if [ "${DIR2}" = "/home/remko/Maildir/.INBOX.spam/new" ]
# then
# /bin/echo "Current dir is new: ${DIR2}" > /dev/null 2>&1
# else
# /bin/echo "Something weird found under: ${DIR2}"
# /bin/mv ${DIR2}/* /home/remko/Maildir/.INBOX.spam/new
# /bin/rmdir ${DIR2}
# fi
#done
#
# Start processing files
/usr/local/bin/sa-learn --spam /home/remko/Maildir/.INBOX.spam/cur > /dev/null 2>&1
/usr/local/bin/sa-learn --spam /home/remko/Maildir/.INBOX.spam/new > /dev/null 2>&1
# Cleanout files that are no longer needed.
/bin/rm -f /home/remko/Maildir/.INBOX.spam/cur/* > /dev/null 2>&1
/bin/rm -f /home/remko/Maildir/.INBOX.spam/new/* > /dev/null 2>&1