davidsen@steinmetz.steinmetz.UUCP (William E. Davidsen Jr) (09/08/87)
Since I posted my everyday DOS directory lister, I thought this one
might be of use. It will list an entire DOS disk including all
subdirectories. It does no fancy formatting, but will produce a
multicolumn listing if you want to send the output to a w-i-d-e printer.
---------------- cut here ----------------
:
#!/bin/sh
#
# rdosdir - recursive DOS directory for XENIX
#
# Author: Bill Davidsen, 12-11-86
#
# Arguments:
# 1 - disk and directory
# 2 - columns of output (opt)
# 3 - print colums (opt)
# see if user needs help
if [ $# -eq 0 -o "$1" = "-h" ]
then # output help and quit
echo "\n\n$0: command format, options in [brackets]"
echo " $0 StartDir [print cols] [print width]"
echo "\nExample:"
echo " $0 a: 2 90"
echo "print all directories on disk A:, double column"
echo "page width of 90 columns"
exit 0
fi
# see if print coulmns specified
if [ -n "$3" ]
then
width=w$3
fi
# process the current directory
temp=/tmp/dd.$$ # temp file name
dosdir $1 | sort >$temp
echo "\n$1\n"
pr -${2}${width}t $temp
# build a list of subdirectories
subdir=`awk '
{ if ($3 == "<DIR>") print $1 "." $2;
if ($2 == "<DIR>" && substr($1,1,1) != ".") print $1
}' $temp`
for dirname in $subdir
do
$0 $1/$dirname $2 $3
done
# clean up
rm $temp
---------------- end ----------------
--
bill davidsen (wedu@ge-crd.arpa)
{uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me