September 23, 2007 5

Shell Script to Delete .svn Folders

By Levi Senft in Mac

This script uses the rm and find commands to recursively delete .svn folders. rm and find can be found on all UNIX based operating systems including Linux and OS X.

    1 #!/bin/sh
    2
    3 echo "recursively removing .svn folders from"
    4 pwd
    5 rm -rf `find . -type d -name .svn`
    6

5 Responses to “Shell Script to Delete .svn Folders”

  1. vic says:

    works great! thanks!!

  2. c says:

    or, to avoid the use of a subshell:
    find . -type d -name .svn -exec rm {} \;

  3. w.pasman says:

    That does not work on OSX: you get “Operation not permitted”. I don’t know but there is something very nasty about these .svn files, something keeps them locked down..

  4. Click here says:

    :) Thanks great post

  5. [...] For Geniuses ยป Shell Script to Delete .svn Folders Shell Script to Delete .svn Folders rm -rf `find . -type d -name .svn` [...]

Leave a Reply