How to remove the “.svn” folders recursively

Often, very often people confuses the export function of the svn with the checkout function. So, in many cases, when a customer gives me an already started project gives me also a lot of unuseful stuff built by a svn system.

In each directory, and recursively in each subdirectory I can find the invisible folder named ".svn". These are really unuseful and, more, they can generate a lot of problems if try to create my svn repository. So I before I create the new repository, I have to remove the ".svn" folders from the received project.


Removing the .svn folders is very simple, but before doing anything destructive I make a copy of the original files, the I've to issue the following command (in a terminal window) inside the project folder:

$ find ./ -name ".svn" -exec rm -rf {} \;

If you are paranoic, as I am you can add a check to remove .svn only if this is a directory:

$ find ./ -name ".svn" -exec rm -rf {} \;

You can also use the svn command line to export the plain code of your repository:

$ svn export /path/of/received/repository /path/of/code

Thee above command should clean the repository from the .svn folders, but if something strange has been applied to the repository it might not work. so refer to previous solutions.

If you are on windows and you are running tortoise svn you can use the export function provided by tortoise.


Releated Post

Leave a Reply

Your email address will not be published. Required fields are marked *