If problem in loop causing weirdness

Having an issue here, specifically (5 lines down) puts x + ’ already
exists’. It spits out the same number of times that the array loops
are reiterating. Here is my concept, both arrays are looping [0]
element to [0] element. When File.exist returns true it should ask
user “once” for a yes or no, if no then it deletes it from the
pics2bmoved array. However as I introduced above, it is asking x
number of times , with x being the number of elements in the array.
Sorry for asking yet another noob question, but the books and
reference didn’t turn up anything specific to this situation.

destdir = Dir[‘C:/testfilesmoved/.’]
destdir.each do |name|
pics2bmoved.each do |x|

 if File.exist?(name) && File.compare(x, name)
      puts x + ' already exists'
      puts 'Do you want to overwrite? "yes" or "no"?'
               ow = gets.chomp.downcase

               if ow == 'no'
               pics2bmoved.delete(x)

  end # for if file.exist?
end # for if ow statement

end # end for pics2bmoved loop
end # end for destdir loop

puts
if pics2bmoved.empty?
puts ‘There are no files to be moved’
else
puts ‘The following files will be moved’
puts pics2bmoved
end # for pic2bmoved list

On 7/3/06, Dark A. [email protected] wrote: