anyone made a 'vtree' program?

D'Arcy J.M. Cain darcy at druid.uucp
Fri Jan 18 05:01:25 AEST 1991


In article <8961 at uwm.edu> datta at vacs.uwp.wisc.edu (David Datta) writes:
>Has anyone made a program or script for UNIX that does a "visual tree"
>similar to the MSDOS program 'vtree' and the MSDOS V4.X tree programs?
>Here is a sample of the output from 'tree':
>
>C:.
>+---APPS
>|   +---DBXL
>|   +---PCTOOLS
>|   +---PE2
>|   +---PROCOMM
>|   +---QSILVER
>|   \---TPASCAL
>+---DATA
>|   +---123
>|   +---DISCOG
>|   |   \---UPLOAD

Happy to oblige.

--------------------------- vtree ----------------------------------
#!/bin/sh
# vtree - Written by D'Arcy J.M. Cain

# See if this is the first call
if [ ! "$1" = "RECURSIVE" ]
then
	SPACES="" export SPACES
	if [ -n "$1" ]; then cd $1; fi
fi

for i in *
do
	if [ $i = "*" ]; then exit 0; fi

	if [ -d $i ]
	then
		echo "${SPACES}+---$DIR/$i"
		cd $i
		SPACES="${SPACES}|   " vtree RECURSIVE
		cd ..
	else
		echo "${SPACES}+---$i"
	fi
done
-----------------------------------------------------------------------

Quick and dirty and can use some polishing but it does the job.

-- 
D'Arcy J.M. Cain (darcy at druid)     |
D'Arcy Cain Consulting             |   There's no government
West Hill, Ontario, Canada         |   like no government!
+1 416 281 6094                    |



More information about the Comp.unix.questions mailing list