ah right, excellent, i shall have a play with this and tailor it to my
setup, thanks Dave.
DAve wrote:
Nicholas Payne-Roberts wrote:
I think my problem is with the usage of the rm command. Even when i
execute it on its own (not within find) it fails to delete the file:
rm -f /home/vpopmail/domains/domain.com/nick/Maildir/.Junk E-mail/cur/*
Executes with no error and fails to delete the contents of the
directory. Could this simply then be due to the fact that rm will not
delete files in a folder using * unless you are currently inside that
directory?
Not entirely sure this will help but here is a snippet from my spam
script which deletes all spam messages over three days old. We run it
every night.
SPAM_PATH="$DOMAIN_PATH/.SPAM"
if [ -d $SPAM_PATH/new ]; then
OLDSPAMNEW=`find $SPAM_PATH/new -type f -ctime +3 -exec rm {} \;`
OLDSPAMCUR=`find $SPAM_PATH/cur -type f -ctime +3 -exec rm {} \;`
echo " Spam messages removed from $SPAM_PATH" >> $TMP
else
echo " No spam folder found, moving on." >> $TMP
fi
$SPAM_PATH is a domain path taken from the vpopmail database plus the
name of the spam folder. I do a quick query to see who has spam
filtering turned on and who doesn't. Then I just run through the list.
It's worked for about two years now and always finds/deletes the spam
messages.
DAve