Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to import messages into Mail from KMail, etc.' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to import messages into Mail from KMail, etc.
Authored by: mipmip on Sep 24, '07 11:33:56AM
&tI improved the script so it can now accept spaces and other symbols in the mail directory names.

#!/bin/bash

mdirname='cur'

find . -name $mdirname | while read from; do
echo $nm
nm=`dirname "$from" | sed 's/[^a-zA-Z0-9]/-/g; s/^-*//; s/--*/-/' `
echo "Converting $from into $nm"

/bin/ls -1 "$from" | while read message; do
echo -n `cat "$from/$message" | grep '^From:' | head -n1 | sed 's/.*]*)>.*/From 1/' | sed 's/^From:/From /'; cat "$from/$message" | grep -m 1 '^Date:' | sed 's/,//g'
 | awk '{print $2" "$4" "$3; "$6" "$5 }'`
echo
cat "$from/$message" | sed 's/^From /From:/'
done > $nm.mbox
done


[ Reply to This | # ]