[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to make Dir.glob method NOT case sensitive.

Kurt Euler

10/28/2004 9:08:00 PM

All-

Can anyone advise as to how to make the Dir.glob method NOT case
sensitive.

For example, in the following routine, I'd like to find all
"PCM_OP*.XML" and "pcm_op*.xlm" occurances in the specified directory:


for f in Dir.glob("m:/some_directory/**/PCM_OP*.XML")
next unless File.file?(f)
count = count + 1
puts File.dirname(f) + "/" + File.basename(f)
end

Thanks!

1 Answer

Eric Hodel

10/28/2004 9:22:00 PM

0


On Oct 28, 2004, at 2:08 PM, Kurt Euler wrote:

> All-
>
> Can anyone advise as to how to make the Dir.glob method NOT case
> sensitive.
>
> For example, in the following routine, I'd like to find all
> "PCM_OP*.XML" and "pcm_op*.xlm" occurances in the specified directory:

See Dir.glob and File.fnmatch in ri

> for f in Dir.glob("m:/some_directory/**/PCM_OP*.XML")
Dir.glob("m:/some_directory/**/PCM_OP*.XML",
File::FNM_CASEFOLD)
> next unless File.file?(f)
> count = count + 1
> puts File.dirname(f) + "/" + File.basename(f)
> end