From: Clement Ow [mailto:[email protected]]
$options=
you may remove the “$” sign 
[“2008*”, “2008*”, “700*”, “2008*”, “2008*”]
and i don’t think these are options but really file/dir
patterns/selections in your case…
$source=
%w[C:/movtest/testing
C:/movtest/testing/new
when you recurse /new will be re-traversed by /testing and
/testing/new. You can remove /testing/new since it has the same option
with /testing or, it would be fine if you do not need to recourse at
all.
U:/movtest/source
U:/movtest/new
U:/movtest/new1]
$dest=
%w[U:/test_1/
U:/dest1/
U:/dest2/
U:/dest3/
U:/dest4/]
while i<=j && i1<=j1 && i2<=j2
hmmm, you just created 3 parallel arrays. Either you can create one
multi-dimensional or a hash.
Dir.chdir($source[i])
you may not need this
print "\nSource: " + Dir.getwd + “\t\n”
print "Dest: " + $dest[i1] + “\n”
print “Options: " + $options[i2] +”\n"
FileUtils.cp_r Dir.glob($options[i2]), $dest[i1]
print “File Mov Test:Success”
i+=1
i1+=1
i2+=1
if you modify your code, you may not need those increments 
end
------------------
Apparently, when moving large files (i.e file size 50mb) it takes
relatively long as when i use ROBOCOPY (a robust copying software by
MSServer),
robocopy seems to do stat on the filetransfer speed to get the optimum
chunk to transfer. You can do something like that in ruby, but you’ll
have to work harder (since your code/logic will get a bit longer)
but I cant use robocopy because it has it’s limitations
it’s not perfect, and w ruby, you can beat it 
i used ruby. As I will be running the ruby program on a server, I cant
afford to use too much memory while transferring files from one folder
to another as the server is used for more impt tasks like running impt
applications in the office.
So is there anything that i could do to quicken the copying process
without compromising on the ability to have different path names and
options for copying files? (i understand that arrays do take up more
memory)
obviously, no problems with array here since it’s very small.
So, if i were to tackle this, i’d first do, (note, this is ruby
pseudocode, ergo untested since i do not have time and space to test it
now…)
source=%w[C:/movtest/testing
C:/movtest/testing/new
U:/movtest/source
U:/movtest/new
U:/movtest/new1]
dest=%w[U:/test_1/
U:/dest1/
U:/dest2/
U:/dest3/
U:/dest4/]
selections=[“2008*”, “2008*”, “700*”, “2008*”, “2008*”]
here i combine those 3 arrays into 1 multi-dim array
sd_a=source.zip(dest,options)
sd_a.each do |sd|
source, destination, selections = sd
src = File.join source,selections
puts “Source: #{src}”
puts “Dest: #{destination}”
i comment the 2 lines below for you to choose bw recurse or not
again, if you recurse, check for directory overlaps
FileUtils.cp src, destination
FileUtils.cp_r src, destination
puts “File Copy Test:Success”
end
END
note the absence of the increments wc makes the code cleaner and
clearer. And if we have a clear code, it makes it easier for us to
monitor/debug and optimize if needed 
kind regards -botp