Linux – How to remove all .svn directories from the application directories

linuxshell

One of the missions of an export tool I have in my application, is to clean all .svn directories from my application directory tree. I am looking for a recursive command in the Linux shell that will traverse the entire tree and delete the .svn files.

I am not using export, as this script will be used for some other file/directory names which are not related to SVN. I tried something like:

find . -name .svn | rm -fr

It didn't work…

Best Answer

Try this:

find . -name .svn -exec rm -rf '{}' \;

Before running a command like that, I often like to run this first:

find . -name .svn -exec ls '{}' \;