From owner-freebsd-isp@FreeBSD.ORG Thu May 29 09:15:09 2003 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E5F7037B404 for ; Thu, 29 May 2003 09:15:09 -0700 (PDT) Received: from thunderbird.etv.net (thunderbird.etv.net [208.14.190.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 404DA43F93 for ; Thu, 29 May 2003 09:15:09 -0700 (PDT) (envelope-from efinleywork@efinley.com) Received: from [208.14.190.162] (helo=elliotdevelop) by thunderbird.etv.net with smtp (Exim 4.10) id 19LQ3N-000BV0-00; Thu, 29 May 2003 10:14:57 -0600 Message-ID: <016801c325fd$73b71dc0$b45ad70a@elliotdevelop> From: "Elliot Finley" To: , "ODHIAMBO Washington" References: <20030523161900.GA12569@ns2.wananchi.com> <200305281731.54434.jamie@tridentmicrosystems.co.uk> Date: Thu, 29 May 2003 10:14:58 -0600 Organization: Emery Telcom MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 cc: freebsd-isp@freebsd.org Subject: Re: Expiring old mail in Maildir/ X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Elliot Finley List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2003 16:15:10 -0000 Here's a short Perl script that I run every night to clear out old mail from my MailDirs --- #!/usr/bin/perl -w use strict; use File::Find; main(); exit; sub usage { print "$0 \n"; exit; } sub main { usage() if (@ARGV != 2); my $dir = $ARGV[0]; my $days = $ARGV[1]; usage() if (not -d $dir); my $seconds = time() - ($days * 24 * 60 * 60); my $wanted = sub { # # if we are looking at a mail file # if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) { if ($ft < $seconds) { print "$File::Find::name\n"; unlink($File::Find::name); } } }; find($wanted, $dir); } --- the regex in this line: if (my ($ft) = $_ =~ m|^(\d+)\.\d+\.|) { has to match the file name of your mail files. I use mail files named like so: 1049831444.88767.thunderbird.etv.net,S=2514 timestamp.procId.domainname,S=filesize ----- Original Message ----- From: "Jamie Heckford" To: "ODHIAMBO Washington" Cc: Sent: Wednesday, May 28, 2003 10:31 AM Subject: Re: Expiring old mail in Maildir/ On Friday 23 May 2003 5:19 pm, ODHIAMBO Washington wrote: > Hiya ISP Admins, > > > Apart from using `find`, I am wondering if someone already owns the wheel > that can expire mail older than N number of days from users Maildir. > I used to use one by Phil Male of Information Systems Engineering Group > which was well adapted for mbox-type mailboxes, but now I have changed to > Maildir/ > > Thanks in advance for any pointers. > We use a tool called archivemail (/usr/ports/mail/archivemail). I wrote a script that loops through all usernames and logs in via IMAP and deletes messages older than 30 days. Cheers, Jamie _______________________________________________ freebsd-isp@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-isp To unsubscribe, send any mail to "freebsd-isp-unsubscribe@freebsd.org"