*BSD News Article 46610


Return to BSD News archive

Xref: sserve comp.unix.misc:17594 comp.unix.admin:30310 comp.unix.bsd:16673 comp.unix.programmer:26857 comp.unix.questions:66417 comp.unix.shell:23484
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.kei.com!newshost.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!agate!tcsi.tcs.com!glock!sriram
From: sriram@glock.tcs.com (Sriram Srinivasan)
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: 9 Jul 1995 21:21:23 GMT
Organization: Teknekron Communications Systems, Berkeley, California
Lines: 11
Distribution: world
Message-ID: <3tph8j$6th@tcsi.tcs.com>
References: <3tk3dc$4ml@rcp6.elan.af.mil> <gora.805186403@pv740d.vincent.iastate.edu>
NNTP-Posting-Host: glock.tcs.com

: In <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.
: 

Another way : ls -F -1 | egrep -v '/$'

Sriram