drawtree for Unix/Sun/curses?

Jerry Peek jdpeek at rodan.acs.syr.edu
Fri Dec 8 00:18:11 AEST 1989


In article <5250 at abaa.UUCP> korsberg at aa.ab.com (Ed Korsberg) writes:
> Does anyone know of a "drawtree" program for Unix?  This is a program
> that displays the directory tree structure.  A good example of this
> is the ncd program in the Norton Utilties for MS-DOS.

Here's a simple one called "stree".  Because this isn't a sources group,
I've edited out the comments and other "nice" stuff.  If you want a copy of
the whole thing (which still isn't very long, anyhow), send me mail.

This was posted to USENET by James A. Woods  {hplabs,hao,ihnp4}!ames!jaw 
(jaw at riacs.ARPA) and attributed to Doug Kerr of Informatics General Corp.
I hacked on it, too.

sed 's/^X//' > "stree.short" <<'X//E*O*F stree.short//'
X#! /bin/sh
X##	IF YOU GIVE IT THE PATH TO A DIRECTORY (USE A RELATIVE PATH!):
X##		% stree bin
X##	IT'LL SHOW YOU ONLY THE SUBDIRECTORIES.  WITH THE -a OPTION:
X##		% stree -a bin
X##	IT SHOWS DIRECTORIES AND FILES.
X
Xcase "$1" in
X-a)	shift; echo Tree for directory $1 and its files: ;;
X*)	findtype="-type d"; echo Tree for directory $1: ;;
Xesac
X
Xecho "
X$1"
Xfind $1 $findtype -print | tr / \\1 | sort -f | tr \\1 / |
Xsed -e s,\^$1,, -e /\^$/d -e "s,[^/]*/, \"	,g"
X//E*O*F stree.short//
chmod u=rwx,g=rx,o=rx stree.short
exit 0

--Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY
  jdpeek at rodan.acs.syr.edu, JDPEEK at SUNRISE.BITNET        +1 315 443-3995



More information about the Comp.unix.questions mailing list