Find to exclude dirs/subdirs
2007-12-25 3:12:00
I have a shell script which creates a Dir structure to newly created Sun
Box from a File which has Dir List.
I would like to create a New File with a complete Dir structure
excluding certain Directories (Only Dirs not files)
If I use
find . -type d
will give me a recursive list of Dirs in a current Dir which is fine.
find . -type d ! -name '[0-9]*'
will exclude Dirs which starts with numbers but to exclude mutilple dirs
find . -type d ! -name '[0-9]*' -o -type d ! -name . -o -type d -name NT
doesn't work neither
find . -type d ! \( -name '[0-9]*' -o -name NT -o -name .snapshot \)
-print
I tried -prune switch as well but it lists files as well besides
directories.
Also tried ls -d * / but it gives dir list in current Dir only not the
recursively
My question is:
How can I exclude multiple directories with find command? I am running
Solaris 8
Do I need any other tool ? or which is a best way to create a dir list
recursively in a current dir without files listing?
Any Help will be greatly Appreciated.
Thanks in advance
B
Comments
Got something to say?
You must be logged in to post a comment.

