Hello,
I have about ~230 MB of email in > 200 nested folders in mbox format
on my home box. Being almost the only user I had none of the usual
reasons to move to MH or Maildir format from mbox until now.
Now I need an efficient search tool for all that stuff, and I found
mairix, which only deals with MH or Maildir, hence I have to switch.
I need to find an AUTOMATIC and SAFE way to do it on all my folders,
preserving their nesting. I came out with the script pasted below,
but:
1) It says "lock failure" on every Maildir folder it works on
2) It places all messages in the "new" subfolder. How do I preserve
the status of each message?
3) It copies AGAIN each message in /var/spool/mail/marco :-(
4) I had to do the ugly rewriting of the real $HOME/.procmailrc
file. How do I give to procmail, when called that way, a different
rc file each time?
How do I fix the problems above? I think this is a fairly general
problem, isn't it? I also know that there is a mbox2mh script
somewhere, but found it better, in principle, and also simpler, to
let the tools I use
all the time to do the conversion
Last but not least: is there anything else I forgot? In my own case
what should I prefer, MH or Maildir?
Thanks in advance for any feedback
Marco Fioretti
################################################################
Here is the script:
#! /bin/bash
# mv mailbox some-name-your-rcfile-does-not-use
# formail -s procmail < some-name-your-rcfile-does-not-use
# OLD and NEW below correspond to the values of the
# mutt folder variable before and after the switch
OLD=/home/marco/.MAIL # old mail archive
L=`echo $OLD|wc -c`
NEW=/home/marco/.MAIL_NEW # new location
for it in `find $OLD -type d` # creating new subdirectories
do
D=`echo $it|cut -c$L-`
# echo FOUND $it
# echo DIR is $NEW$D
mkdir -p $NEW$D
done
#exit
for it in `find $OLD -type f`
do
D=`dirname $it|cut -c$L-`
B=`basename $it`
NEW_FOLDER="$NEW$D/$B/"
echo "Converting $it to $NEW_FOLDER ..."
# echo dirname is $D ...
rm -f $HOME/.procmailrc
echo ":0c:" > $HOME/.procmailrc
echo "$NEW_FOLDER" >> $HOME/.procmailrc
formail -s procmail < $it
done
################################################################
--
Marco Fioretti m.fioretti, at the server inwind.it
Red Hat for low memory http://www.rule-project.org/en/
Don't you wish you had more energy... or less ambition?
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail