mb2md: convert mailbox to Maildir

The traditional Unix mailbox format -- often called "mbox" -- sucks.
Maildir, a format
invented by Dan Bernstein of qmail fame, sucks much, much less.
Unfortunately, all the tools that I could find to convert mbox files to
maildirs suck even more than the mbox format itself. (Eg. they do a
bogus/incomplete conversion and then delete the input mbox without
warning -- that sort of thing.)

So I wrote my own mbox-to-maildir conversion tool, called
mb2md (all the obvious names were taken). Bragging points:

mb2md does not destroy your valuable email. It
insists that the output maildir not exist when you start,
so you know that the output maildir exactly matches
the input mbox. More importantly, it does not remove the input
mbox when finished -- so if you decide you don't like what
mb2md did, you can fallback to your old mbox.

mb2md (or rather, the addtomaildir
script that does the real work) takes considerable pains to
preserve all useful information from your mbox file.
Specifically, new/old/read messages in the mbox remain
new/old/read in the maildir. Also, it attempts to figure out the
delivery time of each message in the mbox, and sets the mtime of
the corresponding message file in the maildir from it -- that way,
you can easily sort the maildir by delivery time.

Requirements/download

You'll need three things to make it work:

an external tool to split the input mbox; currently, either one of
the following will work:

Steven Davis (sgdavis at bioneos dot com)
(suggested a fix for the "addtomaildir runs as shell script"
problem described below)

Share and enjoy!

Alternatives

A couple of people have reported a peculiar problem with
mb2md: when formail runs
addtomaildir, it runs it as a shell script, not as a Python
script. Unsurprisingly, this does not work very well. (Yes, in both
cases I told the person to make sure addtomaildir was
executable, and in both cases it was.) Unfortunately, since I don't
maintain mb2md at all (it's a one-off tool: convert your
mailboxes and you're done with it), I have no time to investigate. But
there's an alternative: Juri Haberland's mb2md.pl. Give it a try.