[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Proof if a File exsists

Jonathan Heinen

7/30/2006 4:13:00 PM

Hi,

I want to proof if a File exsist. I just realize this by

if(Dir.glob(file).length == 0)

But I think there should be a better possibiliti like File.exsists?(file)

Jonathan
3 Answers

Robert Klemme

7/30/2006 4:18:00 PM

0

Jonathan Heinen wrote:
> Hi,
>
> I want to proof if a File exsist. I just realize this by
>
> if(Dir.glob(file).length == 0)
>
> But I think there should be a better possibiliti like File.exsists?(file)

You're close. Check the docs:

http://rub...

robert

Dido Sevilla

7/31/2006 3:41:00 AM

0

On 7/31/06, Jonathan Heinen <Jonathan.Heinen@rwth-aachen.de> wrote:
> Hi,
>
> I want to proof if a File exsist. I just realize this by
>
> if(Dir.glob(file).length == 0)
>
> But I think there should be a better possibiliti like File.exsists?(file)

Actually it's File.exist?(file). There's a whole slew of these file
tests, such as File.directory?, File.readable?, File.writable? and so
on. Have a look at the documentation here:

http://www.ruby-doc.org/core/classes/Fil...

Ron Rosenfeld

8/31/2008 1:28:00 AM

0

On Sat, 30 Aug 2008 13:03:00 -0700, J. Caplan
<JCaplan@discussions.microsoft.com> wrote:

>Thanks for the suggestion. After playing around for a while, I found that I
>can do just that. The trick is to have the .NET DLL that gets the data from
>the database, return back the datatype with each piece of data so that I'll
>know what to convert to on the VBA side (i.e CStr, CDbl, CDate, etc.)

Glad to help. Thanks for the feedback.
--ron