*BSD News Article 46541


Return to BSD News archive

Xref: sserve comp.unix.misc:17569 comp.unix.admin:30271 comp.unix.bsd:16670 comp.unix.programmer:26829 comp.unix.questions:66370 comp.unix.shell:23449
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!cs.utexas.edu!usc!elroy.jpl.nasa.gov!lll-winken.llnl.gov!enews.sgi.com!fido.asd.sgi.com!albion.engr.sgi.com!sp
From: sp@albion.engr.sgi.com (Simon Patience)
Newsgroups: comp.unix.misc,comp.unix.admin,comp.unix.bsd,comp.unix.programmer,comp.unix.questions,comp.unix.shell
Subject: Re: A Unix command to obtain directory name only
Date: 7 Jul 1995 23:21:26 GMT
Organization: Silicon Graphics, Inc.
Lines: 17
Message-ID: <3tkfhm$f5m@fido.asd.sgi.com>
References: <3tk3dc$4ml@rcp6.elan.af.mil>
NNTP-Posting-Host: albion.engr.sgi.com

In article <3tk3dc$4ml@rcp6.elan.af.mil>, Jay J Oh <OHJ%CSCADPS@mhs.elan.af.mil> writes:
|> I am trying to invoke a unix command to obtain only directory names 
|> listing for a given path.  I tried using 'ls -d *', but this includes 
|> files also.  I also tried 'find -type d . -print'  but this command 
|> recursively list all the subdirectories, which I don't want.
|> 
|> Can anyone have any idea how to solve this problem?

	find * -type d -prune -print

Simon.

-- 
  Simon Patience				Phone: (415) 390-4644
  Silicon Graphics, Inc				FAX:   (415) 390-3542
  2011 N. Shoreline Boulevard			Email: sp@sgi.com
  Mountain View, CA 94043