From ed5c1330d2c949e1376d8ade1ead0e67014cb541 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Thu, 23 Feb 2012 01:17:02 +0000 Subject: [PATCH] silly script --- forester/ruby/scripts/do_something.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 forester/ruby/scripts/do_something.rb diff --git a/forester/ruby/scripts/do_something.rb b/forester/ruby/scripts/do_something.rb new file mode 100644 index 0000000..d50c1d1 --- /dev/null +++ b/forester/ruby/scripts/do_something.rb @@ -0,0 +1,23 @@ +require 'set' +require 'fileutils' + +set = Set.new + +File.open('infile', 'r') do |f| + while line = f.gets + set << line + end +end + +counter = 0 +set.each do |s| + puts s + s = s.chomp + '.prot' + if File.file?( s ) && File.size?( s ) + FileUtils.cp( s, "keep/" + s ) + counter += 1 + end +end + +puts "Copied " + counter.to_s + " files." + -- 1.7.10.2