Results 1 to 2 of 2
A bash script or command required to list all the directories under a given path.
I tried this script(command perhaps) for the same:
#!/bin/sh
ls -lR | grep ^d
Though ...
- 06-07-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 3
bash script to list all directories
A bash script or command required to list all the directories under a given path.
I tried this script(command perhaps) for the same:
#!/bin/sh
ls -lR | grep ^d
Though this lists all the dirs, we can really use this to a great extent
- 06-07-2007 #2Just Joined!
- Join Date
- Jun 2007
- Posts
- 3
command to list all directories
Here is a simpler version and efficient version:
#!/bin/sh
Dirlist=$(find . -type d)
for direc in $Dirlist ; do
ls $direc
done
This bash script can be used to recursively list and use directories.
Traverse the directories using bash script search result was to big to find any solution, so thought to delve into Man and got this...
Its so easy if known how to read Man pages...
Srinivas


Reply With Quote