Few days ago, i’m looking for way to delete all the .svn folder. Today i found the way to delete all .svn folder from my project folder in Linux.
To delete all .svn folder in Linux just follow the steps below:-
Advertisements
- Start Terminal
- change your current directory to your project folder (ex: /Users/me/Sites/project_a)
- enter this command
find ./ -name ".svn" | xargs rm -Rf
- Done, all your .svn folder has been deleted.
By the way, you also can apply this method to remove all .svn folder in Mac machine.
Related posts:
How to backup MySQL Database in command line with compression
How to create zip file in Mac OS X
How to play .mkv file in Mac OS X
Password protect directory with .htaccess and .htpasswd
How to install flash player in Ubuntu
How to send email using different profile in Apple Mail
How to setup SSH without password
How to disable Front Row shortcut key in Mac
Share this with your friends:-
Hi Roy, u need to make sure you are at your project folder.
eg. if the svn folder is in /Users/abc/Sites/myproject/.svn
then you have to cd /Users/abc/Sites/myproject/
then use the command at my post to remove all the .svn folder
Am using mac. I used this command. The .svn files stand as it is. and now my Applications directory is not visible in the bash terminal. Any help?
Worked like a charm on OS X – Thank you!
Another way:
find . -iname “*.svn” -exec rm -rf {} ;
=)
InFog
This works for directories that have spaces in the name:
find ./ -name “.svn” | sed ‘s/ /\\ /g’ | xargs rm -Rf
what the fck!!! all my .svn files deleted. i was on the folder in my desktop. then i did this command. but all .svn files in my system have been deleted.
This was very bad thing!!! nevr do this to anyone. if u not sure about the commond dont give!!
This works nicely unless your have spaces in your search path 🙂
It is much better to use xargs with 0 as devider between found directories.
The command will then look like this:
find . -type d -name .svn -print0 | xargs -0 /bin/rm -rf
A client asked me to remove all .svn info in a project for security reasons and I thought I’d have to do a new version or something, but this solved all of my problems. THANK YOU!
@Eranga, that won’t work for large amounts of files. @Merwok’s example does.
Thx a lot, works perfectly on OSX 10.6 Leopard !
Thanks for the post. It helped me alot.
Why -iname? These directories are always lower-case. Moreover, specifying “-type d†will ensure find returns only directories, not regular files. We could also make sure directories with spaces won’t cause the command to break. So:
find -type d -name .svn -print0 | xargs -0 rm -rf
I prefer this:
rm -rf `find -iname .svn`
Thanks. It works for me in linux. ubuntu 8.04 but nautils-svn cache still show the svn icon overlay but there was no .svn folders.
Thanks again.
This did no work for me on OSx.