Date: Wed, 17 Aug 2005 11:58:43 -0400 From: Matt Juszczak <matt@atopia.net> To: Kevin Kinsey <kdk@daleco.biz> Cc: freebsd-questions@freebsd.org Subject: Re: OT: Removal of old 14+ mail from mbox-based mail spool (not maildir) Message-ID: <43035EB3.7080300@atopia.net> In-Reply-To: <43035504.4020300@daleco.biz> References: <43034EA2.4000206@atopia.net> <43035504.4020300@daleco.biz>
next in thread | previous in thread | raw e-mail | index | archive | help
| Also, a script in sh(1), or do you have some other > language available? I have a short PHP script > that does something similar and could be modded, > perhaps. > > OTOH, somebody around here could probably > give you a one-liner with sh, sed, grep, awk, date, > test, etc., but I was at the hospital last night until > 2 a.m. and don't think I can pull it off ATM.... > > Kevin Kinsey > I want to clean out an IMAP "folder" (actually file $HOME/mail/Spam). We have about 10,000 users and our users don't check their spam quarantine often, so our policy is to remove messages after 14 days. I know how to: 1) recursively pull each Spam folder in existance (for x in `ls /home/*/mail/Spam`; do ....; done) 2) Use grep and awk to pull each message and its relative data (grep the date, parse it) What I'm not sure of is how to remove a message from the spool itself. Should I just use grep and/or sed to "pull until new From header", then remove those lines from the spool manually? This would be easier if I could use IMAP, because then I could use the built-in PHP functions for imap to check dates and remove messages. Problem is, we don't know the user's passwords (they are hashed). Any other ideas? Thanks! -Matt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43035EB3.7080300>