[lug] Virtual Mail User - Large Mailbox Scrubbing

John Hernandez John.Hernandez at noaa.gov
Thu Jun 29 16:29:02 MDT 2006

Ryan Fligg wrote:
> I have a bit of a problem that is taking WAY too much time out of my day.  I 
> have a virtual user who has over 100,000 messages in his mailbox.  The 
> directory is in maildir format.  I cannot simply su to the username and 
> launch pine/mutt to delete non important messages.  I tried launching 
> squirrelmail but there are too many message for it to handle. 
> Another developer I work with recommended your list and said to ask about 
> using Awk to search and remove message from the maildir store.  I would like 
> to start by removing all messages that have "Undeliverable" in the subject 
> heading.  I was trying to make my way through grep to do this but was not 
> getting far.  If anyone has any ideas, they would be much appreciated.

formail + procmail might be a good combination for this job.

~/.procmailrc would contain something like this:


then run:

formail -s procmail < oldmaildir


 |  John Hernandez - NOAA Boulder NOC - 303-497-6392
 |  Mailstop R/OM62. 325 Broadway, Boulder, CO 80305
 |  PGP Public Key ID: 586A7E23

More information about the LUG mailing list