From: "H.Yamamoto" Date: 2005-04-04T00:19:59+09:00 Subject: Re: File.fnmatch and ** Hi. Thomas Sondergaard wrote: (2005/04/01 18:54) >Dir.glob('**/*') matches directories recursively, but >File.fnmatch('**/*', "a/b/c", File::FNM_PATHNAME) returns false. I >thought (from reading the docs at ruby-doc.org) that the patterns are >supposed to be the same. > >Can I match directories recursively with File.fnmatch? Well, File.fnmatch on ruby1.9 works like that. irb(main):002:0> File.fnmatch('**/*', 'a/b/c', File::FNM_PATHNAME) => true irb(main):003:0> File.fnmatch('a**/*', 'a/b/c', File::FNM_PATHNAME) => false irb(main):004:0> File.fnmatch('**/b*', 'a/b/c', File::FNM_PATHNAME) => false irb(main):005:0> File.fnmatch('**/*', '/a/b/c', File::FNM_PATHNAME) => true irb(main):006:0> File.fnmatch('**/*', 'c:/a/b/c', File::FNM_PATHNAME) => true Does this fit your need?