Old files left over from experiments few weeks ago.
[cocanwiki.git] / tools / import_mbox.sh
1 #!/bin/sh -
2
3 # Usage: import_mbox.sh servername username password < mbox
4
5 set -e
6
7 d=/tmp/$$.mail
8 mkdir --mode=0700 $d
9
10 # Read the mbox from stdin and split it into separate files in the directory.
11 formail -s sh -c "tail +2 > $d/\$FILENO"
12
13 # Now run import_mail.sh on groups of files.
14 ls -1 $d | sed -e "s|^|$d/|" | xargs ./import_mail.sh "$@"
15
16 # Remove the mail directory.
17 rm -rf $d