Converting Maildir to mbox via mutt

Ran into an issue today where I needed to convert a Maildir containing over 50k messages to mbox format and couldn’t really find any good tools. So I found this blog post about using mutt to do it. Unfortunately, it converted one Maildir to another. =( One crucial piece is missing, so here is the one-liner in all its glory:

$ mutt -f Archive/ -e 'set mbox_type=mbox; set confirmcreate=no; \
set delete=no; push "T.*<enter>;sarchive<enter><quit>"'

The above converts the Maildir Archive/ to the mbox named archive. It also makes the assumption that mbox_type is set to Maildir (which is how I have it configured; if it wasn’t for that, the default is mbox and that’s what it would have created, but I changed the default to Maildir, hence the need to be specific). Line break was added for clarity.

4 Comments

  1. Francis

    Thanks, found it really useful!

    Mar 10, 2010 @ 16:57:02
  2. szarpaj

    Yeah, and i found bunch of stupid scripts and here it is — i can convert my maildirs with mutt! Thanks, awesome tip.

    Jan 06, 2012 @ 16:52:48
  3. Converting Mailman archives (mboxes) to maildir « muellis blog

    [...] I use mutt myself I found this blog article promising. It uses mutt to create a mbox out of a maildir. I wanted it the other way round, so [...]

    Nov 13, 2012 @ 13:02:41
  4. mumbi

    Thank you,it worked like a charm!

    Feb 27, 2013 @ 23:23:51

Leave a Reply

*