Recursively erase files/folders with a find by name

The following command is an easy and fast way to recursively erase all the files and folders matching a specific pattern.

In the following example I needed torecursively  remove all the .svn folders from a specified base folder.

First you need to open a terminal and go to the base folder, then you need to execute the following command:

 

find . -name ".svn" -type d -exec rm -rf {} \; 

 

The \; is part of the command so you have to include it.

Obviously "*svn*" could be replaced with the pattern you need to match.