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

advertisement

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

  • Start Terminal
  • change your current directory to your project folder (ex: /Users/me/Sites/project_a)
  • type
    find ./ -name ".svn" | xargs rm -Rf
    and enter.
  • 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 Post


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

  1. InFog says:

    Another way:

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

    =)

    InFog

  2. drewvs says:

    This works for directories that have spaces in the name:

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

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

  4. 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

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

  6. Scott Wallace says:

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

  7. Psykna says:

    Thx a lot, works perfectly on OSX 10.6 Leopard !

  8. Anil S says:

    Thanks for the post. It helped me alot.

  9. 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

  10. Eranga J says:

    I prefer this:

    rm -rf `find -iname .svn`

  11. 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.

  12. SoN9ne says:

    This did no work for me on OSx.

Leave a Reply