home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3554
< prev
next >
Wrap
Internet Message Format
|
1991-06-26
|
1KB
From: vandys@sequent.com (Andrew Valencia)
Newsgroups: alt.sources
Subject: MH folder repack
Message-ID: <1991Jun27.001016.6053@sequent.com>
Date: 27 Jun 91 00:10:16 GMT
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@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