silly script
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 23 Feb 2012 01:17:02 +0000 (01:17 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 23 Feb 2012 01:17:02 +0000 (01:17 +0000)
forester/ruby/scripts/do_something.rb [new file with mode: 0644]

diff --git a/forester/ruby/scripts/do_something.rb b/forester/ruby/scripts/do_something.rb
new file mode 100644 (file)
index 0000000..d50c1d1
--- /dev/null
@@ -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."
+