I wrote this down in my notes.txt awhile back where it’ll eventually get lost, putting it here so that I search it from google:
find ./ -name ".svn" | xargs rm -Rf
I wrote this down in my notes.txt awhile back where it’ll eventually get lost, putting it here so that I search it from google:
find ./ -name ".svn" | xargs rm -Rf
Doesn’t work.
C:\>find ./ -name “.svn” | xargs rm -Rf
‘xargs’ is not recognized as an internal or external command,
operable program or batch file.
C:\> 😛
Dude, Unix/Linux command line Not windows Command Prompt!
Great hint. Also, for those that don’t know, you can checkout a clean copy of the code directly from subversion by using “svn export”. This leave you with a perfect copy of the code, without the .svn folders.
THANKS ! I am moving to git right now and I was wondering how to free my repo from those evil .svn files 🙂 – you’re tip did the job.
Here is a slightly more efficient way of doing the same thing:
find ./ -name .svn -exec rm -rf {} \;
When you use -exec find will execute the command for every result returned via the find query into the argument {}
Another useful command is to only perform and operation on files that have not been added or modified. You can do this like so:
svn status | grep ? | awk ‘{print $2}’ | xargs rm -rf
This would remove any file that has been added to the repository.
Breaking it down
svn status will return results like this:
? foo
M build/projects/Community.iml
M build/build.properties
Piping it through grep ? will give you:
? foo
Awk can be used to print out the column we want that is what the print $2 part of the awk command is for.
foo
finally pass the results to xargs rm
Hope this is interesting.
cheers,
A.J.
hey, can you suggest any way that will help me to find a particular file and delete it via command prompt.
plz.
I use:
find ./ -name “.svn” -exec rm -rf {} \;
which does the same thing with out the pipe (not that that matters though)
worked for me in Cygwin
I had trouble with these if the pathnames contained spaces. This seemed to work however:
find ./ -name “.svn” -exec rm -rf “{}” \;
Could also do
find ./ -name “*.svn” -delete
How about svn export? 😛
svn export doesn’t get out unversioned files…. so, in some cases it doesn’t work
Thanks!
It still helps! Even 2 years later 😉
Still helps, even 4 years later 🙂
thanks!
Thanks for this. Very helpful!
Very helpful even now!
worked! thanks!
I found another choice. Just to share it with all of you:
rm -rf `find . -type d -name .svn`
The key is the grave accent quotes in this case. It worked in a split second.
Still helps, even 6 years later
thanks!
If the paths contain spaces then this will do:
find ./ -name ".svn" -print0 | xargs -0 rm
but again as many people already posted the pipeless version is nicer:
find ./ -name .svn -exec rm -rf {} \;