MH folder repack
Andrew Valencia
vandys at sequent.com
Thu Jun 27 10:10:16 AEST 1991
I use MH through its shell command interface, and I've always missed
a function to shuffle everything down so that the message numbers
start from 1 and count up by 1. I finally wrote a shell script to
help myself, and here it is! Standard disclaimer, use at your own
risk.
Andy Valencia
vandys at sequent.com
#!/bin/sh
#
# Utility to repack an MH folder. Assumes your folders are in ~/Mail.
#
if [ ! -d $HOME/Mail ]
then
echo "I don't know how to find your mh folder directory"
exit 1
fi
for x
do
folder=`expr $x : '+\(.*\)' \| $x`
echo "Repacking $folder...\c"
cd $HOME/Mail
if [ ! -d $folder ]
then
echo " no such folder"
exit 1
fi
cd $folder
files=`/bin/ls [0-9]* | sed '/^[0-9]*$/!d' | sort -n`
echo ""
cnt=1
for y in $files
do
echo " $y -> $cnt"
if [ $y -ne $cnt ]
then
mv $y $cnt
fi
cnt=`expr $cnt + 1`
done
done
exit 0
More information about the Alt.sources
mailing list