If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to list only directories

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-11-03, 15:13
aruneeshsalhotr aruneeshsalhotr is offline
Registered User
 
Join Date: Jul 2003
Location: US
Posts: 314
Lightbulb How to list only directories

Hi
I had a basic question on Unix.
I know in DOS, one could use dir /ad to list only directories in a given path.

I wanted to know what is the equivalent command in UNIX for the same.
Reply With Quote
  #2 (permalink)  
Old 07-11-03, 16:53
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool

Try:

find . -type d

Reply With Quote
  #3 (permalink)  
Old 07-11-03, 17:00
aruneeshsalhotr aruneeshsalhotr is offline
Registered User
 
Join Date: Jul 2003
Location: US
Posts: 314
Lightbulb Your response

find . -type d
works fine


but


ls -d ./ * show even the files
Reply With Quote
  #4 (permalink)  
Old 07-11-03, 19:08
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
Re: Your response

I don't know if there is a command option to do it , but you can do

ls -l | grep ^d

HTH

Cheers

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 07-11-03, 19:10
aruneeshsalhotr aruneeshsalhotr is offline
Registered User
 
Join Date: Jul 2003
Location: US
Posts: 314
Hi Satya
That command really did the job.

I have the command in one of the postits, before I get handy.

Thanx and Regards
Aruneesh
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On