Subject: Auto mail expiry?

From: [email-masked] (David Karr)
Date: Wed, 15 Dec 93 11:16:05 PST

> Hi,                                                                     
>        
>         Has anyone implemented a scheme using procmail where messages   
> were automatically filed into a folder and then and messages in that    
> folder which were more than a few days old were auto-deleted? I'd like
> to keep the most recent messages for various mailing lists I'm on and
> I'm wondering if anyone has managed to accomplish this already. 
>        
> thanks                                                                  
>        
>         Craig.                                                          

My solution to this has two parts.

First, my crontab entry:

15   0	*   *	*   find /home/dkarr/Mail -name "[1-9]*" -mtime +4 -exec /home/dkarr/bin/rmnotlast {} \;

I store my mailing list notes in subdirectories of ~/Mail, in numbered
files.  I'm saying to delete any of those files that are more than 4
days old.

Second, my "rmnotlast" script:
------------
#! /bin/ksh
filename="$1"
dir=`dirname $filename`
count=`/bin/ls $dir/ | wc -l`
if [[ $count -gt 1 ]]; then
    /bin/rm -f $filename
fi
------------

I use "rmnotlast" instead of "rm", because I have to make sure I do
not remove the last numbered file in any directory.  If I do, then the
numbering sequence will be messed up.

================================================================================
David M. Karr                                           GTE - Government Systems
[email-masked]			       w:(206)487-8578   h:(206)483-1732

---

From: /usr/mail/brian <[email-masked]>
Date: Wed, 15 Dec 1993 12:01:45 -0800

On Dec 15,  4:54pm, Craig Cockburn wrote:
> Subject: Auto mail expiry?
> Hi,                                                                     
>        

Once the messages were in the correct folder, I would suggest using cron
and mush. mush is able to manipulate messages on a wide variety of
criteria, but works with them once they are already in the folder. Here
is a command which would delete all messages that are one week old or more:

        pick -ago -1w | delete

IMHO, with procmail to do the pre-processing, and mush to do the
post-processing, I have an unbeatable mail combination.

Brian

-- 
Brian Dockter                    | Northwest Digital Systems
UUCP: uunet!nds!brian            | Voice: 206-524-0014
Internet: [email-masked]          | FAX: 206-524-3440

---

From: Sridhar Venkataraman <[email-masked]>
Date: Wed, 15 Dec 1993 14:34:28 -0700 (MST)

Ok folks, before reinventing the wheel :-), just check out this one.

Seems it does the job quite well as far as I have tested (on IRIX).

Sridhar.
-=-=-=
From: [email-masked] (ron nash)
Newsgroups: comp.unix.admin
Subject: Re: Unix Mail Expiration Program
Date: 10 Dec 1993 15:16:26 GMT
Message-ID: <[email-masked]>

Try em.  I have em.shar on anonymous ftp for ucssun1.sdsu.edu under
/pub/unix.  This was posted to alt.sources a while ago.  Here is part
of the README:

Expire Mail works by scanning the mailboxes specified on the
command line and reporting on messages that are older than the
specified age, or deleting messages older than the specified
age, or both.

Expire Mail has been tested under SunOS 4.1 and BSD 4.3.
It also compiles and appears to work under AT&T System V 3.1.

-=-=-=

-- 
Sridhar Venkataraman   ASU, Tempe, Arizona USA   [email-masked]