Newsgroups: comp.unix.questions
Path: utzoo!telly!problem!druid!darcy
From: darcy@druid.uucp (D'Arcy J.M. Cain)
Subject: Re: anyone made a 'vtree' program?
Message-ID: <1991Jan17.180125.8998@druid.uucp>
Keywords: find
Organization: D'Arcy Cain Consulting, West Hill, Ontario
References: <33@tdw205.ed.ray.com> <8961@uwm.edu>
Distribution: usa
Date: Thu, 17 Jan 91 18:01:25 GMT

In article <8961@uwm.edu> datta@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@druid)     |
D'Arcy Cain Consulting             |   There's no government
West Hill, Ontario, Canada         |   like no government!
+1 416 281 6094                    |
