Automatic deletion/purge of spam folder?


We get tons of spam mail, and spam assassin does a good job of putting it in the junk folder. I’m new to dreamhost… is there a way for the spam folder to automatically purge after X days? Does it do that now? Thanks!


You can do it with cronjob.

37 19 * * * find /path_to_spamdir -maxdepth 1 -ctime 7|xargs rm -rf

If I didn’t make any stupid typo or mistake, this crontab would delete any file in the spamdir older than 7 days (after its creation date) at 19:37, every day.

If you have doubt, consult wiki and/or man page of “find” command for more detail.

To setup crontab, you can create a file called mytab or whatever,
and also another one called cron.cgi:

exec 2>&1
crontab mytab
crontab -l

You need to put both file in the same directory (password protected directory).
And you need to set executable permission to the .cgi file.
I think you can do all these in WebFTP.

...* I’d be happier if DH had free shared SSL and redundant server setup. ..*.