*BSD News Article 46550


Return to BSD News archive

Xref: sserve comp.unix.misc:17572 comp.unix.admin:30273 comp.unix.bsd:16671 comp.unix.programmer:26831 comp.unix.questions:66372 comp.unix.shell:23452
Newsgroups: comp.unix.misc,comp.unix.admin,comp.unix.bsd,comp.unix.programmer,comp.unix.questions,comp.unix.shell
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!daffy!uwvax!uchinews!vixen.cso.uiuc.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!jhalpin
From: jhalpin@netcom.com (Joe Halpin)
Subject: Re: A Unix command to obtain directory name only
Message-ID: <jhalpinDBD8J5.5r2@netcom.com>
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
References: <3tk3dc$4ml@rcp6.elan.af.mil>
Date: Fri, 7 Jul 1995 21:47:29 GMT
Lines: 24
Sender: jhalpin@netcom11.netcom.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?
>
>
>Jay J Oh
>OHJ%CSCADPS@mhs.elan.af.mil
>
>

I usually use

	ls -l | grep '^d'

Joe
-- 
Joe Halpin 
jhalpin@netcom.com 
---------------------------------------------------------------------------