From owner-freebsd-questions@FreeBSD.ORG Wed Aug 17 15:58:44 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BFA4016A41F for ; Wed, 17 Aug 2005 15:58:44 +0000 (GMT) (envelope-from matt@atopia.net) Received: from neptune.atopia.net (neptune.atopia.net [209.128.231.90]) by mx1.FreeBSD.org (Postfix) with ESMTP id 78E2F43D53 for ; Wed, 17 Aug 2005 15:58:44 +0000 (GMT) (envelope-from matt@atopia.net) Received: from [192.168.0.102] (pcp173257pcs.plsntv01.nj.comcast.net [68.46.70.16]) by neptune.atopia.net (Postfix) with ESMTP id 8623B617E; Wed, 17 Aug 2005 11:58:43 -0400 (EDT) Message-ID: <43035EB3.7080300@atopia.net> Date: Wed, 17 Aug 2005 11:58:43 -0400 From: Matt Juszczak User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050701) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Kinsey References: <43034EA2.4000206@atopia.net> <43035504.4020300@daleco.biz> In-Reply-To: <43035504.4020300@daleco.biz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: OT: Removal of old 14+ mail from mbox-based mail spool (not maildir) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2005 15:58:44 -0000 | 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