On Thu, Nov 8, 2012 at 11:08 AM, Peter Hickman <
[email protected]> wrote:

> This is the code you posted
>
> $files.each_with_progress do | val |
>    $files.each do |element|
>        FileUtils.cp("#{$old_home}/#{$sName}", "#{Dir.pwd}/#{element}")
>     end
>  end
>

I do especially wonder what val is used for and why there seem to be two
iterations through $files - this is O(n*n).

Your description looks contradictory to me: on one hand you say that $files
holds destinations and then you say that one file is replaced by 139 files
(which would mean $files contain sources).

To copy a file into destinations

src = File.join old_home, sName

$files.each do |dst|
  FileUtils.cp src, dst
end

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to