How to delete all .svn folder in Linux / Mac?


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.




Share this with your friends:-

15 Responses to “How to delete all .svn folder in Linux / Mac?”

  1. chua says:

    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

  2. Roy says:

    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?

  3. Noonin says:

    Worked like a charm on OS X – Thank you!

  4. InFog says:

    Another way:

    find . -iname “*.svn” -exec rm -rf {} ;

    =)

    InFog

  5. drewvs says:

    This works for directories that have spaces in the name:

    find ./ -name “.svn” | sed ‘s/ /\\ /g’ | xargs rm -Rf

  6. Amjith says:

    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!!

  7. Holger says:

    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

  8. Andrea says:

    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!

  9. Scott Wallace says:

    @Eranga, that won’t work for large amounts of files. @Merwok’s example does.

  10. Psykna says:

    Thx a lot, works perfectly on OSX 10.6 Leopard !

  11. Anil S says:

    Thanks for the post. It helped me alot.

  12. Merwok says:

    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

  13. Eranga J says:

    I prefer this:

    rm -rf `find -iname .svn`

  14. Palaniraja says:

    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.

  15. SoN9ne says:

    This did no work for me on OSx.

Leave a Reply