<<< Date Index >>>     <<< Thread Index >>>

Re: purging mailboxes



* On 28 Jan 2011, Jean-Pierre Radley wrote: 
> 
> It would be nice to automate the maintenance, so: could a script (also
> run by cron) manage a mailbox by pruning messages older than some
> <number> of days, or by deleting all but the last <number> of messages?

Have your script save to a maildir folder instead of mbox.  With a
maildir, scripted message expiration is as easy as a find -mtime.  If a
gunslinger approach is not a problem you can just unlink all messages
found by find, but to do it properly (without potential collisions with
other software) you should rename the messages from new/ or cur/ into
tmp/ before unlinking.

-- 
David Champion  *  dgc@xxxxxxxxxxxx  *  IT Services  *  University of Chicago