Jan 02 2011

Learn a bit of Ruby every day: Dir.exist?

Category: ruby,tutorialgiordano scalzo @ 10:38 pm

Introduced in 1.9, it’s a cool method to know if a directory exists:

Dir.exist?("/tmp") # => true
Dir.exist?("/temp") # => false

A more correct alias is Dir.exist?.