Download this file

testmbox.sh    43 lines (35 with data), 1.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
files='
/home/dockes/projets/fulltext/testrecoll/mail/attach
/home/dockes/projets/fulltext/testrecoll/mail/fred
/home/dockes/projets/fulltext/testrecoll/mail/fred1
/home/dockes/projets/fulltext/testrecoll/mail/outmail
/home/dockes/projets/fulltext/testrecoll/mail/recursive
/home/dockes/projets/fulltext/testrecoll/mail/strangedate1
/home/dockes/mail/amis
/home/dockes/mail/caughtspam.1
/home/dockes/projets/fulltext/testrecoll/mail/tbird/Sent
'
#files=/home/dockes/projets/fulltext/testrecoll/cjk/mbox
fatal()
{
echo $*; exit 1
}
test $# = 1 || fatal Need topdir arg
topdir=$1
echo $topdir
test -d $topdir || fatal $topdir does not exist
mh_mbox=${mh_mbox:-mh_mbox}
echo mh_mbox $mh_mbox
for mbox in $files;do
dir=`basename $mbox`
#echo $topdir/$dir
rm -rf $topdir/$dir
mkdir $topdir/$dir
echo "Processing $mbox"
nmsg=`${mh_mbox} $mbox | tail -1 | awk '{print $1}'`
echo nmsg $nmsg
for i in `jot $nmsg`;do
${mh_mbox} -m $i $mbox > $topdir/$dir/$i
done
done