Path: utzoo!utgpu!cs.utexas.edu!uunet!sequent!muncher.sequent.com!vandys From: vandys@sequent.com (Andrew Valencia) Newsgroups: alt.sources Subject: MH folder repack Keywords: mh Message-ID: <1991Jun27.001016.6053@sequent.com> Date: 27 Jun 91 00:10:16 GMT Sender: vandys@sequent.com (Andrew Valencia) Organization: Sequent Computer Systems Inc Lines: 43 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