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.
I use:
find ./ -name “.svn” -exec rm -rf {} \;
which does the same thing with out the pipe (not that that matters though)
Pingback: ऋतेश का बलोग
worked for me in Cygwin
Pingback: Scott Motte » Blog Archive » Removing .svn files and folders
Pingback: Aaron Johnson – command line script to delete .svn files / folders | Bookmarks
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
Pingback: Blog de Bastien Paul » Unix command to delete .svn folders
Still helps, even 4 years later
thanks!
Thanks for this. Very helpful!