[Dovecot] Re: Advice on converting from Mbox to Maildir?

David Champion dgc at uchicago.edu
Wed Jun 2 23:07:44 EEST 2004


* On 2004.06.02, in <1086204944.24881.158.camel at tesuji.nac.uci.edu>,
*	"Dan Stromberg" <strombrg at dcs.nac.uci.edu> wrote:
> 
> I did this recently.
> 
> For converting from mbox to Maildir, check out mb2md.  I converted a
> huge collection of folders using it.

Ah, I meant to address that too. Since procmail supports Maildir, you
can also convert with procmail. It's probably slower to do so than with
any dedicated conversion utility, but it uses a smaller and consistent
set of tools.

Here's a shell script. It doesn't address permissions or ownerships,
and it doesn't delete the mbox folder.

#!/bin/sh
test -n "$1" || exit 5
convert () {
	MBOX="$1"; export MBOX
	mv "$MBOX" "$MBOX.mbox"
	mkdir "$MBOX"
	formail < "$MBOX" -s procmail "$pmrc"
	# rm -f "$MBOX"
}
pmrc=${TMPDIR-/tmp}/`basename $0`.pmrc
cat <<'PMRC' >"$pmrc"
:0
$MBOX/
PMRC
for folder in "$@"; do
	convert "$folder"
done
rm -f "$pmrc"


N.B. This, too, is untested.

-- 
 -D.    dgc at uchicago.edu                                  NSIT::ENSS
        No money,  no book.  No book,  no study.  No study, no pass.
        No pass, no graduate. No graduate, no job. No job, no money.
             T h e   U n i v e r s i t y   o f   C h i c a g o



More information about the dovecot mailing list