2010/8/23 Ralph Shnelvar <ralphs / dos32.com>:
> Assume I have a file pattern
>  
>
> Assume I have a directory d:\XXX
>
> and that I want to find all instances using Windows' file matching mechanisms rather than than Ruby regular expressions or the functionality of fnmatch.
>
> In other words ... it _has_ to be the Windows file matching method exactly.

What exactly do you mean by "Windows file matching method"?  Windows
uses globbing very similar to most Unix shells.  So as long as you
stick with using "*" and "?" you can just use Dir.glob or Dir.[].

> I see that FileUtils has a bunch of functionality but what I want is something like
>
>  򢩮    >
>
> Is there a gem "out there" to do what I want?

For the pattern above you only need

batches = Dir['MyDir/*.bat']

or if you want to get fancy:

batches = Dir[File.join('MyDir', '*.bat')]

For the fully recursive version you can do

batches = Dir['MyDir/**/*.bat']

and be done.  No Gems required.  You can even do

batches = Dir['MyDir/**/*.{bat,cmd}']

and really get all Windows batch files.

Kind regards

robert

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