Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!rpi!nisc.nyser.net!rodan!jdpeek From: jdpeek@rodan.acs.syr.edu (Jerry Peek) Newsgroups: comp.unix.questions Subject: Re: drawtree for Unix/Sun/curses? Message-ID: <1487@rodan.acs.syr.edu> Date: 7 Dec 89 13:18:11 GMT References: <5250@abaa.UUCP> Reply-To: jdpeek@rodan.acs.syr.edu (Jerry Peek) Organization: Syracuse University, Syracuse, NY Lines: 36 In article <5250@abaa.UUCP> korsberg@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@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@rodan.acs.syr.edu, JDPEEK@SUNRISE.BITNET +1 315 443-3995