[CentOS] Expunge Old Email

Mon Oct 3 14:05:51 UTC 2011
Duncan Brown <centos at duncb.co.uk>

On 27/09/2011 13:31, John Hinton wrote:
> For those of you running mailservers on CentOS 6, what are the
> suggestions for programs to expunge old email? For instance, deleting
> email from a Spam folder that is 2 weeks old or older.
>
> I see that Dovecot does have a solution, but was wondering about what
> others have landed on.
>
> My systems are basically Postfix, Dovecot using Maildir.
>
> Thanks,
> John Hinton
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
I just use a daily cron job with regex, never had much luck with 
dovecots method:

# delete 30 day old mails from Trash
find /var/mail/ -regex '.*/\.\(Trash\|Junk\)\(/.*\)?\/\(cur\|new\)/.*' 
-type f  -ctime +30  -exec rm '{}'  \;

# delete 200 day old mails from mailinglists
find /var/mail/ -regex 
'.*/\.\(Fedora\|Atrpms\|Centos\|Mythtv\)\(/.*\)?\/\(cur\|new\)/.*' -type 
f  -ctime +200  -exec rm '{}'  \;


cheers

Dunc