Skip to main content
Add warning about deleting files that start with .svn
Source Link

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

find . -path '*/.svn*' -delete

Note that in addition to deleting '.svn' directories (and their contents), this will also delete any files or directories whose names start with '.svn'. For example, if you used -path '*/.git*' it would also delete '.gitignore' and '.gitattribute' in addition to '.git/'. To avoid that, and just delete directories with that exact name use:

find . -path '*/.svn/*' -or -name '.svn' -delete

Note the slash after .svn. This will first find, and delete, all the files under '.svn', then delete the .svn directory itself.

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

find . -path '*/.svn*' -delete

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

find . -path '*/.svn*' -delete

Note that in addition to deleting '.svn' directories (and their contents), this will also delete any files or directories whose names start with '.svn'. For example, if you used -path '*/.git*' it would also delete '.gitignore' and '.gitattribute' in addition to '.git/'. To avoid that, and just delete directories with that exact name use:

find . -path '*/.svn/*' -or -name '.svn' -delete

Note the slash after .svn. This will first find, and delete, all the files under '.svn', then delete the .svn directory itself.

Adds missing apostrophe.
Source Link
kenorb
  • 22.1k
  • 18
  • 149
  • 172

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

 find . -path '*/.svn*svn*' -delete

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

 find . -path '*/.svn* -delete

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

find . -path '*/.svn*' -delete
Source Link
Magnus
  • 433
  • 1
  • 5
  • 8

I've found that the -delete action does work nicely with the -path test. For instance, the following ought to work on the original posters problem:

 find . -path '*/.svn* -delete