How to Find or Exclude Directories Matching a Pattern in Linux

directoryfindlinuxrecursive

I'm trying to use the Linux find command to find all directories and sub-directories that do not have .svn (Subversion hidden folders) in their path. I can only get it to exclude the actual .svn directories themselves, but not any of the sub-directories.

Here is what I'm doing right now:

find . -type d \! -iname '*.svn*'

I've also tried:

find . -type d \! iname '.svn' \! iname '.svn/*'

Just an FYI, I'm trying to use the find pattern so I can apply some subversion properties to all directories in my repository excluding the subversion hidden folders and their sub-directories (by applying the exec command to the directories returned from the find command)..

TIA

Best Answer

find . -type d -not \( -name .svn -prune \)