一段删除.svn目录的ruby脚本

require 'find'
require 'fileutils'

default_path = "."

DIR = ARGV[0] || default_path

count = 0
Find.find(DIR) do |path|
  if FileTest.directory?(path) and File.basename(path) == ".svn"
    FileUtils.rmtree path
    count += 1
  end
end
puts "警告:成功删除了#{count}个目录!"

你可能感兴趣的:(SVN,脚本,Ruby)