Hi

Got any suggestion on how to improve this Filecopy code snippet below?

$files.each_with_progress do | val |
   $files.each do |element|
       FileUtils.cp("#{$old_home}/#{$sName}", "#{Dir.pwd}/#{element}")
    end
 end

Some guidelines to the variables in the code:

The '$files' variable contains an array of destinations(paths), about
139 different paths at the moment.

$old_home and $sName is the sourcepath and sourcefilename of the file to
be copyed.

Basically, the code replaces one specific file with 139 other files with
the same name and extension in 139 different location. Or you could say,
it updates 139 files with copy/replace.

In my point of view, it seems like the code is trying to copy 139 files
at the same time to 139 different location withoutcompleting one
"copyaction" at the time before copying another file. Wouldn't it be
more efficient to wait for one file to be completely replaced before
starting another "copyaction". Am I wrong? Got any suggestion on how to
improve this code?

Please ask if anything was unclear.

Thanks in advanced!

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