Clement Ow wrote:
> I just started ruby not too long ago and I'm really new to the language.
> But I came out with something; to copy files from path names to path
> names using each respecive array elements.

You might try something such as:



#!/usr/bin/ruby

def copyfiles(files)
  files = files.split(",")

print "Copy to Where?: "
dir = gets.strip!
curdir = Dir.pwd

 files.each do |copy|
   Dir.chdir(curdir)
   input = []
   IO.foreach(copy){|x| input << x}

   Dir.chdir("/")
   Dir.chdir(dir)
   output = File.new(copy,'w+')
   output.puts input
   output.close()
 end
 end

copyfiles('testdoc1.txt,testdoc2.txt')

#######

I'm not familiar with ROBOCOPY so I dont know what the memory usage 
difference would be between this and robocopy, but give it a shot and 
see what happens.

- Mac

-- 
Posted via http://www.ruby-forum.com/.