Find to exclude dirs/subdirs

From: Bhavesh Shah (bshah@citadon.com)
Date: Thu Apr 08 2004 - 19:57:33 EDT


Hi Gurus,

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
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:28:26 EDT