Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Does this require the first line to run? Commented Mar 12, 2014 at 1:25
  • Answered my own question, no. Commented Mar 12, 2014 at 1:27
  • So this works just fine, I feel that the non quoted version was more widely accepted as the correct answer. Commented Mar 12, 2014 at 3:11
  • 1
    The major difference between this and the accepted answer is not the quotes (I have those to protect from shells trying to prematurely expand the glob), but the -prune. It's a different way of accomplishing the same task. And as for the first line: any time you are running a find -delete, you should run it without the -delete first, to make sure you're not doing something unintended. Commented Mar 17, 2014 at 18:29
  • 1
    Good answer. When replacing -path "./.git/*" with -path "*/.git/*" then it works for excluding multiple git repositories which are under one common directory. Like projects/project1/.git and projects/project2/.git then this can be run directly inside the projects/ directory. Commented Sep 26, 2017 at 19:32