Listing directories and subdirectories

How can list the directories and the subdirectories in a folder. It is possible with a single UNIX command.

For example i have a folder named "archive" and another folder named "0808" and then multiple folders are there ...

Can i list all the directories and subdirectories in the folder 0808.

Thanks

Karan

find archive/0808 -exec ls -ld {} \;

You might also have something like dirtree to list a directory and its subdirectories.

ls -R

Yes it is easy, please use the above command.

vasanth

Era,

This command is showing the file names in the directory as well..

Is it not possible just to list the directory names and the sub directores ..

Thanks

Karan

find archive/0808 -type d -exec ls -ld {} \;

If you don't want the long-format listing change the -exec ... \; to just -print

Yes, it is:

find <startdirectory> -type d -print

prints only the names of the directories, not the files. If you want to output to be "ls -l"-like (more exactly: like "ls -lisa") replace the "-print" with "-ls".

I suggest you read the man page of "find" to learn what other possibilities of changing the output there are.

I hope this helps.

bakunin