On Wed, Aug 18, 1999 at 09:35:20PM -0230, Chris Gushue wrote:
> Is there a way to archive mailboxes at the beginning of every month (or
> some other period) like Pine does? Just after a couple weeks, my
> debian-user mailbox (mbox) is 3.6 MB with over 1200 messages. As the
> mailbox gets bigger, Mutt takes longer to open it.
> 
> Eg. move the contents of debian-user to debian-user-1999-aug
> 
> Any solution would be great, not necessarily a mutt-specific one
> (eg. procmail/crontab/scripts/etc). I'm sure I saw a message about this
> on a mailing list I am on, but couldn't find anything. Perhaps it was on
> a newsgroup somewhere...

A few years ago I started archiving an extra copy of all my incoming
email as it's received (with procmail), and find it really nice
to be able to hit "d" or ^d when reading mail without worrying
about losing something important.

I use something like this in my .procmailrc:

    ARCHIVEDIR=$HOME
    TODAY=`date +%Y/%m/%d`

    # make today's archive directory if it doesn't already exist
    :0 ic
    * ? test ! -d $ARCHIVEDIR/$TODAY
    | mkdir -p $ARCHIVEDIR/$TODAY && chmod 0755 $ARCHIVEDIR/$TODAY

    # archive everything
    :0c:
    $ARCHIVEDIR/$TODAY/.

The "/." at the end of the last line says to use an MH-like format
for storing the messages (one message per file, which I like because
it lets me use tools like find, grep, and glimpse to find individual
messages in the archives later.)

You can also just specify a filename to archive all mail by month
or day in a single mbox file, a la:

    # you need to make sure this directory exists first
    ARCHIVEDIR=$HOME/archives
    YYMM=`date +%Y-%m`

    # archive everything
    :0c:
    $ARCHIVEDIR/$YYMM

(that would save all mail into ~/archives/1999-08 )

or, if you just want mutt-users archived by itself,

    # archive everything
    :0c:
    * ^Sender.*mutt-users
    $ARCHIVEDIR/mutt-users-$YYMM

The "c" in ":0c:" says to store a copy of the message and pass the
message along to the rest of the procmailrc for further processing.
The archive stuff needs to appear near the top of your procmailrc
to catch all messages before they get filtered.

I recommend using filenames like yyyy-mm instead of 1999-aug
because they appear in date-order when sorted alphabetically.
(like in the output of ls.)

Hope this helps,

-- 
Gerald Oskoboiny <[EMAIL PROTECTED]>
http://impressive.net/people/gerald/

Reply via email to