Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long directory listings throughout directory tree.... 2

Status
Not open for further replies.

MyBN

IS-IT--Management
Nov 22, 2005
1
US
I'm trying to get a long listing of all directories in the directory tree, but using option d as listed in the man pages does no good.

ls -d <- does not work properly for me

The best alternative solution I found to do this job is using find and grep as follows...

find . -type d -exec ls -l {} \; | grep "^d"

is there a better way to this?
 
I'm not sure this will improve what you already have, but I don't think you need to pipe your results through "grep" if you modify your find command like so:

find . -type d -exec ls -ld {} \;
 
No need to exec ls either, most finds have a -ls option.

[tt]find . -type d -ls[/tt]

Annihilannic.
 
Annihilannic, how do you pass the -ld options to the ls command with your suggestion ?
 
The -ls "action" in find lists a file in `ls -dils' format. It's just built into find.

(Compare to the -print action, which just prints the name.)
 
That must be an option of "find" that isn't on all releases. In SCO OpenServer (which may not be "BEST", but is pretty damn reliable and "good"), I get this:

$ find . -type d -ls
find: incomplete statement

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top