Elia Schito

Wipe out all Subversion informations with a single line of ruby

In Ruby, Ruby snippets, Subversion, SVN on June 29, 2007 at 11:20 am

From your working copy root, type:

ruby -e '`find . .svn | grep svn`.each{ |file| `rm -rf #{file}` if /\/\.svn\/$/ =~ file }'

Surely there’s some redundancy in this code (and does not work on Windows too), tell me the better solutions.
This is not like svn export. With svn export you get only the files under version control.

  1. far too complicated. shorter (and without ruby interpreter overkill)

    find . -type d -name .svn | xargs rm -rf

  2. Thanks glaszig, I was a young Rubyist when I wrote that snippet…
    here’s the savvy version

    ruby -e "Dir['**/.svn'].each {|f| FileUtils.rm_rf f}" -run

    still longer, but works on windows too ;)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: