I keep having the following problem when dealing with svn: I frequently find myself wanting to add to my own SVN repository stuff(javascript libraries, rails plugins) retrieved from some other svn repositories. The inevitable outcome of my bold attempt is that SVN starts complaining that the new folders can’t be submitted, that they already are under code control or something.
The reason is because when copying entire FOLDERS from one svn repository to another, you also copy their associated .svn folders with svn-specific information. These .svn folders are usually hidden, but you can see them (on Unix/Linux/OSX) by running ls -la from the terminal.
So you see my problem: I want to copy files or folders into my code repository, but don’t want to involve svn into this. I want them to be added as new files/folders, regardless of where they came from.
The following command-line command has helped me avoid quite a bit of frustration today:
find . -name "*.svn" -print
find . -name "*.svn" -ok rm -rf {} \;
The first command lists recursively all svn-specific subfolders of the current one.
The second command displays them to me one after the other and patiently awaits I press ‘y’ to remove it.
Extremely useful, right?
For many more uses of the find command, check out this page - where I learned about the useful ‘ok rm’ trick.
Pe vremea asta…
- 2007: Timbre de odinioara
- 2006: Cine e inventatorul anului?
- 2005: Google Blog Search
- 2005: NOT3S DOT NET
Daca esti nou pe aici, nu uita sa te abonezi la feedul meu RSS
. Iti multumesc pentru vizita!
Software engineer; master in cercetare algoritmica la Ecole Polytechnique Paris; a lucrat in Paris in software bursier.

September 14th, 2007 at 7:50 pm
Call me pedantic, but you’ll want to make sure you’re removing only directories named .svn, not any file that happens to match the “*.svn” pattern. So you’ll want to do something like:
find . -name .svn -type d -ok rm -rf {} ‘;’
-type d matches only directories.
September 14th, 2007 at 8:10 pm
thanks for the -d correction. and, yes, you are pedantic
- really now, why would I have useful files named .svn , and why wouldn’t the manual check discover them
?
September 16th, 2007 at 4:27 am
svn export?
September 17th, 2007 at 5:57 am
Yep, Cristian has the nose for these things. You can svn export your current working copy (or remote svn’s base copy) directly into the new project.
svn export . /path/to/other/project
No need to run odd finds.