On Tue, Apr 10, 2012 at 9:42 PM, Charlie B. <lists / ruby-forum.com> wrote:
> Steve Klabnik gets the gold star today.  Using Dir.glob this can all be
> done in one line of code.  Thank you!

That solution has two issues:
1. It does not filter by type.
2. It unnecessarily expands the path.

FileUtils.cp Dir["dir1/*"].select {|f| test ?f, f}, "dir2"

Or, with Pathname

FileUtils.cp Pathname.glob("dir1/*").select(&:file?), "dir2"

Cheers

robert

-- 
[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}
http://blog.rubybestpractices.com/