Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ruby directory exists

  • exists

if ARGV.length != 1
  puts "Usage: #{$0} DIRNAME"
  exit
end

dirname = ARGV[0]
if Dir.exists? dirname
  puts "#{dirname} exists"
else
  puts "#{dirname} does NOT exist"
end