Ruby script to remove svn folders

This code is so useful and pretty easy too when we want to remove recursively recursive the .svn folders from a project we want to send.

The credit of the original code is @HelgeG guy

This was only enhanced to make a warning first and count the kills, still under testing.

require 'find'
require 'fileutils'

puts "\n\t\t\t! WARNING !\n\nYou are about to remove .SVN from this folder and all sub-folders"
puts "# This program is to be used on a backup folder, no way back! \nCONTINUE?"
resp = gets

if resp.include?('s') || resp.include?('y')
	i = 0
	Find.find('./') do |path|
	  if File.basename(path) == '.svn'
		FileUtils.remove_dir(path, true)
		i += 1
		Find.prune
	  end
	end
	puts "#{i} .svn folders were deleted along with their juice.."
	sleep 3
end
puts "Bye"
sleep 1

Use on your own Risk!

Advertisements

4 thoughts on “Ruby script to remove svn folders

  1. What is SVN?
    Its stand for: ‘Subversion’, a system where one, or a team, can merge code and keep old versions of the same code, the leader may create ‘branches’ where a project split in different ways, there are a lot of other cool tools people can use in SVN, as history, diff etc.
    -Look in Wikipedia for more

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