On Aug 23, 2010, at 11:47 AM, Ralph Shnelvar wrote:
> Robert,
>
> Monday, August 23, 2010, 9:25:56 AM, you wrote:
>
> RK> For the pattern above you only need
> RK> batches = Dir['MyDir/*.bat']
> RK> or if you want to get fancy:
> RK> batches = Dir[File.join('MyDir', '*.bat')]
> RK> For the fully recursive version you can do
> RK> batches = Dir['MyDir/**/*.bat']
> RK> and be done.  No Gems required.  You can even do
> RK> batches = Dir['MyDir/**/*.{bat,cmd}']
> RK> and really get all Windows batch files.
>
> Is the stuff, above, some sort of 1.9 syntax?  Do you really mean  
> square brackets?
>
> On 1.8 ... I cannot get anything you wrote, about, to work.


Different Rob(ert), but yes, there is a [] method defined on Dir

There's no reason to think that it wouldn't work on your Windows  
system.  Mine is a Mac, but the ruby code is the same:

irb> RUBY_VERSION
=> "1.8.6"
irb> Dir['*.rb']
=> ["listdiff.rb"]
irb> Dir['code/ruby/mailing_list/**/*.rb']
=> ["code/ruby/mailing_list/assoc.rb", "code/ruby/mailing_list/ 
merge_csv.rb", "code/ruby/mailing_list/sales_data_graph.rb", "code/ 
ruby/mailing_list/simulating_vehicles.rb", "code/ruby/mailing_list/ 
sorting_with_numbers.rb"]

Note that *I* have a code/ruby/mailing_list/ directory, but you'd have  
to use directory names that exist on your system.

-Rob

Rob Biedenharn		
Rob / AgileConsultingLLC.com	http://AgileConsultingLLC.com/
rab / GaslightSoftware.com		http://GaslightSoftware.com/