On Thu, Mar 14, 2002 at 08:37:06PM -0800, Craig Dickson wrote:
> begin  Alan James  quotation:
> 
> > I'd like to give maildir a go, so how do I convert MH to MailDir ?
> 
> If you use procmail, just set up new empty maildir folders corresponding
> to each of your old MH folders, edit .procmailrc to use the new folders
> (and to know that they're in maildir format), then run all your old
> messages back through procmail again.

    I just went through this last week, and had a *lot* of hand-sorted
    folders. 

    Here's the script I used. It uses a program called "safecat",
    google's your buddy for that: 

#!/bin/sh

SAFECAT=/usr/bin/safecat
MAILD=/home/petro/Maildir/
$here=`pwd` 
for DIR in `ls -1`
do
    echo "doing $here/ $DIR :" 
    if [ ! -d $MAILDIR/$DIR ]
    then
        mkdir -m 2700 $MAILD/$DIR
        mkdir -m 2700 $MAILD/$DIR/cur
        mkdir -m 2700 $MAILD/$DIR/new
        mkdir -m 2700 $MAILD/$DIR/tmp
    fi    
    
    cd $DIR
    echo "Inside: "
    pwd 
    for FLE in `ls -1` 
    do
        cat $FLE | $SAFECAT $MAILD/$DIR/tmp  $MAILD/$DIR/cur
    done
    cd ..
    echo "$DIR done"
done

Basically safecat is just used to give the MH mail file the proper
Maildir name. You could fake this by generating your own. According to
the safecat man page the format for the file name is
<time>.<pid>.<host>, where time is seconds in the Unix Epoch, pid is,
well, pid, and host is, well, the hostname. 

Any, HTH. 

-- 
Share and Enjoy. 

Reply via email to