MAILDIR! (was Re: Organising Mail)
Seamus Cawley wrote:
> What i'm wondering though is is there a better way as the second
> folder now takes a few seconds to load
I use a couple of tricks.
If somebody knows any better, please improve on this mini-tutorial! :-)
1.
Archive old mail by year. Save all the messages you received in 2004 in
a folder called 2004 and such. I usually do that when I'm a few months
into the new year (like February 2005 in the example.) Commands:
open big mailbox
T '~r 01/01/04-31/12/04'
; s '2003'
(Create mailbox 2003?) y
Look 'T' and ';' up in the manual for details.
Make a compressed backup of your mailboxes before experimenting.
2.
Use the maildir format instead of mbox. You do that by creating a
directory (which will be the mailbox) with three subdirs: cur, new, tmp.
There probably is a simpler way of doing it, but I don't know any.
Commands:
(outside mutt, or inside but using '!', the shell escape)
mkdir -p 2003/{cur,new,tmp}
(now you have an efficient mailbox called '2003/')
WHAT IS MAILDIR
The basic idea behind maildirs is having a directory for each mailbox,
containing the messages as single files. Main advantages: opening the
mailbox and deleting messages are done MUCH faster.
Why? To create the index view for a mailbox, mutt has to read all the
headers of all the messages in the mailbox. With a regular mbox mailbox
(the whole mailbox = a single file) mutt will read and parse the whole
file. If we consider a mailbox with 1000 messages sized 10kB each, 1kB
of which are headers, mutt has to read and parse a full 10MB of data.
With a maildir mailbox (one file per message) mutt can 'jump' between
messages, reading and parsing the headers only. Continuing the example,
mutt will only read and parse 1MB of data! That's 10 times faster!
The bigger and fatter messages and folders you have, the more maildir
makes the difference. Take for example a mailbox for storing those
stupid chain messages with pictures and stuff: then a more correct
figure is 2MB per message, 2kB of which are headers. Then a maildir
will load in ONE THOUSANDTH (1/1000) of the time!! (Give or take some)
Toby
--
«A computer is a state machine. Threads are for people
who can't program state machines.» —Alan Cox