[comp.unix.questions] drawtree for Unix/Sun/curses?

korsberg@abaa.uucp (Ed Korsberg) (12/04/89)

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.
------------------
Ed Korsberg
korsberg@aa.ab.com

subbarao@phoenix.Princeton.EDU (Kartik Saligrama Subbarao) (12/06/89)

In article <5250@abaa.UUCP> korsberg@abaa.UUCP (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 is a question I have been wanting to ask for a long time but
 always forgot to. WHY doesn't someone make a whole NORTON UTILITES
 for UNIX? I mean, it is SO easy to unerase files in MS-DOS. If UNIX
 is a superior operating system, why hasn't someone come up with a 
 qu command to unerase files, an ncd to change directories and some of
 the other goodies we get with the Norton Utilities 4.5 Advanced
 Edition?


				-Is UNIX really superior ???
				 Kartik Subbarao

subbarao@phoenix.princeton.edu
subbarao@bogey.princeton.edu
subbarao@gauguin.princeton.edu

6600pete@hub.UUCP (12/07/89)

From article <11976@phoenix.Princeton.EDU>, by subbarao@phoenix.Princeton.EDU (Kartik Saligrama Subbarao):
> In article <5250@abaa.UUCP> korsberg@abaa.UUCP (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 is a question I have been wanting to ask for a long time but
>  always forgot to. WHY doesn't someone make a whole NORTON UTILITES
>  for UNIX? I mean, it is SO easy to unerase files in MS-DOS. If UNIX
>  is a superior operating system, why hasn't someone come up with a 
>  qu command to unerase files, an ncd to change directories and some of
>  the other goodies we get with the Norton Utilities 4.5 Advanced
>  Edition?

Heh. The fact that you can unerase DOS files means that DOS doesn't erase them
very well. Unerasure of files is not a feature, it's a bug. Were it a feature,
IBM or Microsoft would have put unerasure in the OS. They haven't. Given
this perspective, is unerasure under UNIX a good thing? No. Just do

    alias rm rm -r

and hope for the best.

The reason we don't have an ncd for UNIX is that an ncd process could change
its own default directory, but not that of its caller. I think you're right
about the directory tree lister, though.
-------------------------------------------------------------------------------
Pete Gontier   : InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
Editor, Macker : Online Macintosh Programming Journal; mail for subscription
Hire this kid  : Mac, DOS, C, Pascal, asm, excellent communication skills

jdpeek@rodan.acs.syr.edu (Jerry Peek) (12/07/89)

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

dan@charyb.COM (Dan Mick) (12/08/89)

In article <5250@abaa.UUCP> korsberg@abaa.UUCP (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.

Well, since everyone is too busy indulging in petty little disgust-fests
about the prospect of anyone using MS-DOS ever, I'll break in and say
that there's a program called vtree in comp.source.unix volume16.  I've
compiled it on our Sun-3/50.
-- 
.sig files are idiotic and wasteful.

exspes@gdr.bath.ac.uk (P E Smee) (12/08/89)

In article <11976@phoenix.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Saligrama Subbarao) writes:
>    Here is a question I have been wanting to ask for a long time but
> always forgot to. WHY doesn't someone make a whole NORTON UTILITES
> for UNIX? I mean, it is SO easy to unerase files in MS-DOS. If UNIX
> is a superior operating system, why hasn't someone come up with a 
> qu command to unerase files, an ncd to change directories and some of
> the other goodies we get with the Norton Utilities 4.5 Advanced
> Edition?

Probably because the Unix filesystem is designed around a totally
different set of concepts than the MS-DOS filesystem, made worse by the
fact that Unix is a multi-user system and MS-DOS (usually, at least) is
not.

Norton will only successfully unerase a file IF you have not written
anything to the disk (except re-writing the directory) since you erased
the file.  The odds that *someone* won't have written something to the
disk since you erased your file must be vanishingly small on any Unix
of any size.

Plus, in MS-DOS, you own the particular bit of disk real-estate
involved.  In Unix you don't own any particular bit of the disk
surface.  (In IBM VM/CMS you do, and that creates nightmares of it's
own, including vast amounts of disk wastage.)  Bit hard to see how,
even if you forced a delay between rm'ing a file and the actual
vanishing of the inode where it really lives (and associated disk
bits), you could give individual users an unerase command without
giving them the potential to look through everything else which has
been deleted recently.

You can sort of simulate the effect my making yourself an erase command
which moves the file to some special dir like $HOME/Trash, and a bit in
your .login, .profile, or .logout which really removes anything that's
been in there for some amount of time.
-- 
 Paul Smee, Univ. of Bristol Comp. Centre, Bristol BS8 1TW (Tel +44 272 303132)
 Smee@bristol.ac.uk   :-)   (..!uunet!ukc!gdr.bath.ac.uk!exspes if you HAVE to)

es@sinix.UUCP (Dr. Sanio) (12/08/89)

In article <11976@phoenix.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Saligrama Subbarao) writes:
>
>    Here is a question I have been wanting to ask for a long time but
> always forgot to. WHY doesn't someone make a whole NORTON UTILITES
> for UNIX? I mean, it is SO easy to unerase files in MS-DOS. If UNIX
> is a superior operating system, why hasn't someone come up with a 
> qu command to unerase files, an ncd to change directories and some of
> the other goodies we get with the Norton Utilities 4.5 Advanced
> Edition?
>				-Is UNIX really superior ???
>				 Kartik Subbarao
Guess you get a lot of unfriendly replies on your questions. First, to your
question why there are no Norton utilities in unix: Actually, unix standard
utilities can do nearly everything (down to the hardware level) to the system
and its resources, whereas PC utilities (PCtools, Norton etc) were developed
because the standard MSDOS utilities proved incomplete and ineffective.
Agreed, usage of unix is more complex than that of MSDOS, but so is the system
itself. And there are some (graphical & non-graphical) user interfaces which
highly ease the usage.
In fact, "unerasure" of files is impossible in unix file systems. DOS file
system (derived from CP/M), on the other hand, uses disks very inefficiently
(quickly fragmenting it) and is designed for single-user purposes. The possi-
bility of "unerasure" is more accidential than intended. (Note: if you have
a simple waste disposal, you can pick out something unintentionally thrown
away. Different if you have a waste chute in your flat)
The question which system is "superior" can be answered in different ways.
Considering the abilities to do things such as multi-user login, multi-tasking,
multi-terminal support and the ability to run on a wide variety of hardware,
unix is clearly superior.
But depending on what you want to do, those abilities may sometimes simply be
overkill. And there are numerous well-designed programs under DOS which may
fulfill your demands. So the choice is left to you.
best regards, es

daniel@island.uu.net ((Dan Smith)) (12/09/89)

In article <11976@phoenix.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Saligrama Subbarao) writes:
>    Here is a question I have been wanting to ask for a long time but
> always forgot to. WHY doesn't someone make a whole NORTON UTILITES
> for UNIX? I mean, it is SO easy to unerase files in MS-DOS. If UNIX
> is a superior operating system, why hasn't someone come up with a 
> qu command to unerase files, an ncd to change directories and some of
> the other goodies we get with the Norton Utilities 4.5 Advanced
> Edition?

	Vtree (and dtree) is a freely available PD program which shows the
subdirectory tree.  NCD is a very good program for Messy-Dos, and
it should not be that tough to implement under curses.  Dired is also
nice.

	UNIX [*] is superior to MS DOS in many ways; few would argue with
that...there are many ways of using aliases or otherwise replacing "rm"...one
of the quickest solutions is to make a ~/.trash directory, and make the alias:

alias rm	'mv -f \!* ~/.trash'

[*] especially BSD (fast file system, symlinks, etc.)

				dan
-- 
   dansmith@well.sf.ca.us   daniel@island.uu.net   unicom!daniel@pacbell.com
ph: (415) 332 3278 (h), 491 1000 (w) disclaimer: Island's coffee was laced :-)

guy@auspex.auspex.com (Guy Harris) (12/13/89)

 >...is unerasure under UNIX a good thing? No. Just do
 >
 >    alias rm rm -r
 >
 >and hope for the best.

A bit of a desperate hope, since the "-r" flag tells "rm" to fully
remove any subdirectories it finds ("r" for "recursive"); it sure
doesn't make it any *less* likely that you'll accidentally blow files
away, and probably makes it *more* likely.  Did you perhaps mean
"alias rm rm -i" ("i" for "interactive"), so that it'll ask you before
removing anything?

6600pete@hub.UUCP (12/13/89)

From article <2704@auspex.auspex.com>, by guy@auspex.auspex.com (Guy Harris):
>  >...is unerasure under UNIX a good thing? No. Just do
>  >    alias rm rm -r
> "alias rm rm -i" ("i" for "interactive"), so that it'll ask you before
> removing anything?
 
Yup.
 
There's another thread somewhere in all caps clarifying this. Basically,
I use rm -r all the time and rm -i almost never. Thus...
-------------------------------------------------------------------------------
Pete Gontier   | InterNet: 6600pete@ucsbuxa.ucsb.edu, BitNet: 6600pete@ucsbuxa
Editor, Macker | Online Macintosh Programming Journal; mail for subscription
Hire this kid  | Mac, DOS, C, Pascal, asm, excellent communication skills