[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Fast check if files exist

eggie5

8/24/2007 8:03:00 PM

I have list (array) of file names in the form:

5_4.3g2
5_5.3gp
5_6.3gp
.
.
.

What's the fastest way I can check if these files exist in a given
directory?

2 Answers

Xavier Noria

8/24/2007 8:10:00 PM

0

On Aug 24, 2007, at 10:05 PM, eggie5 wrote:

> I have list (array) of file names in the form:
>
> 5_4.3g2
> 5_5.3gp
> 5_6.3gp

My bet:

(filenames - Dir.entries(dirname)).empty?

-- fxn


eggie5

8/24/2007 9:26:00 PM

0

On Aug 24, 1:10 pm, Xavier Noria <f...@hashref.com> wrote:
> On Aug 24, 2007, at 10:05 PM, eggie5 wrote:
>
> > I have list (array) of file names in the form:
>
> > 5_4.3g2
> > 5_5.3gp
> > 5_6.3gp
>
> My bet:
>
> (filenames - Dir.entries(dirname)).empty?
>
> -- fxn

AHHH very clever and it seems to work!

Thanks