On Thu, Nov 8, 2012 at 11:08 AM, Peter Hickman <
peterhickman386 / googlemail.com> 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/