(I realize this is a pretty old message, but I'm still catching up
from a several-month-deep backlog, and didn't see a reply to this
query).

2000-12-09-12:04:38 Nollaig MacKenzie:
> I found a nice script, mbox2maildir, which converts a mbox file to
> a maildir format.  I know that the inverse script, maildir2mbox,
> exists, but I can't find it.

I suspect most people write their own, it's so easy. The one I use
is:

    #!/bin/sh
    progname=`basename $0`
    die(){ echo "$progname: $*">&2; exit 1; }
    test $# -eq 1 || die "syntax: $0 maildirname"
    cd "$1" || die "$0: cannot cd to $1"
    test -d tmp -a -d new -a -d cur || \
        die "$0: $1 does not appear to be a maildir"
    find cur -type f|sort|while read f;do
        formail -I 'Status: RO' <$f
    done
    find new -type f|sort|while read f;do
        formail -I 'Status:' <$f
    done

It uses the formail command that accompanies procmail to do the
header thagomizing, and emits the mbox on stdout.

-Bennett

PGP signature

Reply via email to