19

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

Avery Payne
  • 14,804

5 Answers5

26
find . -type d -not \( -name .svn -prune \)
Dan Carley
  • 26,127
5

What about simply

find . -type d |  grep -v '.svn'
wazoox
  • 7,156
5

What about the -path option to find?

find . -type d ! -path '*.svn*'
Amandasaurus
  • 33,461
3

You could use:

find . -type d -not -wholename '*.svn*' 
idbrii
  • 203
2

find . -path './tmp' -prune -o .......