[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vps-mail] cronjob to delete mails older than 7 days in mailbox



On Thu, Apr 08, 2004 at 09:18:32PM +0200, Martin Fischer wrote:
> Hello, 
> 
> please help with a small how-to: Is it possible to delete mails
> older than 7 days with a cronjob?

Alright, I'm a freak. Sorry. I just couldn't resist this challenge:

    http://perlcode.org/tutorials/sysadmin/mail_newer/

The long version is 11 lines of Perl, the short version is 7 lines.
That's much better than the link I sent you earlier (of course, mine
isn't as featureful, but it is small and does only one thing).

You'd run it like this, Martin:

0 5 * * * formail -s /path/to/mail_newer 7 < /path/to/mailbox > /path/to/mailbox.new && mv /path/to/mailbox.new /path/to/mailbox

Try it on some test files first, of course.

Scott
-- 
Scott Wiersdorf
scottw@xxxxxxxxxxxx
======================================================================
This is <vps-mail@xxxxxxxxxxxx>       <http://www.perlcode.org/lists/>
Before posting a question, please search the archives (see above URL).


Main Index | Thread Index
Match: Format: Sort by:
Search: