Proof if a File exsists

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

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://ruby-doc.org/

  robert

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/FileTest.html

ยทยทยท

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)