1846665 Members
4951 Online
110256 Solutions
New Discussion

Re: Directory listing

 
james gould
Frequent Advisor

Directory listing

Need a way to list only directories

Used ls -pR to list directories and subdirectories but it also prints out files
contained under the subdirectories which I do
not want. Again I'm just looking at printing out a directory structure.

Thanks
11 REPLIES 11
Madhu Kangara
Frequent Advisor

Re: Directory listing

ls -l|grep drw
steven Burgess_2
Honored Contributor

Re: Directory listing

Hi James

find . -name "*" -type d

hth

Steve
take your time and think things through
Jim Mallett
Honored Contributor

Re: Directory listing

I use: ll |grep drw
But I know that is not 100% accurate.

Your best bet would be to use the find command with -type. Do a man find for the syntax.

Jim
Hindsight is 20/20
Patrick Wallek
Honored Contributor

Re: Directory listing

# find . -type d -print

Would be your best bet. You don't need to specify the '-name' parameter since you want all directories.

If you want to see permissions you could also do:

# find . -type d -exec ls -ld {} \;

or

# find . -type d | xargs ls -ld
Balaji N
Honored Contributor

Re: Directory listing

ls -lR | grep ^d

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Jeff Schussele
Honored Contributor

Re: Directory listing

find /start_dir -type d

-print is implicit

Rgds,
Jeff (Who's SUCH an H&P typer....LESS is more!)
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
twang
Honored Contributor

Re: Directory listing

list current dir and its subdur:
# find . -type d -print;
RAC_1
Honored Contributor

Re: Directory listing

ll -p|grep "/"
There is no substitute to HARDWORK
Sanjiv Sharma_1
Honored Contributor

Re: Directory listing

# ls -lR | grep dr
Everything is possible
Keith Bevan_1
Trusted Contributor

Re: Directory listing

find . -type d -print

Keith
You are either part of the solution or part of the problem
Manuel Plaza
Regular Advisor

Re: Directory listing

ll -F |grep /