Maildir

Coverting Maildir to mbox

Submitted by sklav on Mon, 04/12/2010 - 15:12

#!/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

Note: This works on a per user basis but can be modified to work system wide.