[NCLUG] mbox -> maildir

Bob Proulx bob at proulx.com
Tue Apr 6 18:34:48 MDT 2010


grant at amadensor.com wrote:
> Has anyone converted mbox to maildir?  I am thinking about making this
> conversion, and would like to know if there are any things in particular I
> should be watching out for or careful of.

I use Maildir format and mbox format side by side routinely for my
daily email.  That is my main mailbox is Maildir format but other less
used folders are mbox format.  I use mutt as the MUA.  Since mutt can
read either mbox or Maildir format the way I convert messages from one
to the other is simply to visit the folder in mutt and then save all
of the messages into the other mailbox.

Additionally procmail can write to either mbox or Maildir folders, as
well as other formats.  It is nothing special there either.

There aren't any special gotchas to be aware of going from mbox to
Maildir format.  Nor the other way around really.  However mbox has
some mbox gotchas.  Lines that start with "From " are separators and
therefore need to be quoted.  When you get used to using Maildir
format files you will not see those quoted ">From " anymore.  You will
forget that mbox needs that quoting.  You will start to write lines
>From here to eternity and forget that people with Maildir formats will
see exactly what I wrote (no ">" quoting) while those with mbox format
will see it with a ">" quote in front of it. :-)

The performance characteristics of the two formats are different.
Sometimes one is faster.  Sometimes the other is faster.  With mbox I
can use compressed folders easily.  Copying the file around is quick.
But Maildir format can't be compressed as easily.  Plus copying them
around means creating a lot of small files.  Opening and creating many
files or opening and reading many files is slower than just streaming
data into or out of one file.  But if you only need to open one or two
of the files then it is much faster.  So generally opening and reading
the current mail with my Maildir format mailbox is very fast, faster
than mbox.  But if I decide to search through my mailbox looking for
something then it now has to open and read every file and that is
slower than if it were all in one mbox file.  Each has its own
advantage.

I tend to keep my current mailbox in Maildir format and then archive
the older stuff into compressed mbox format.  When I start to get more
than about 10,000 messages in my Maildir format mailbox then it starts
to slow down.  That prompts me to start pruning things off.

Bob



More information about the NCLUG mailing list