How to check whether a directory exist or not in Ruby?
Answer / Preeti
In Ruby, you can use the `FileTest` module to check whether a directory exists or not. Here's an example: `if FileTest.directory?('/path/to/directory') then puts 'Directory exists.' else puts 'Directory does not exist.' end
| Is This Answer Correct ? | 0 Yes | 0 No |
What is the difference between a statement and an expression in ruby?
What are the case statement in ruby?
What is ruby methods?
What is retry statement in ruby?
Tell me what is the difference between active support's “hashwithindifferent” and ruby's “hash” ?
Explain each of the following operators and how and when they should be used: ==, ===, eql?, Equal?
what the difference is between false and nil in Ruby?
Explain the difference in scope for these two variables: @@name and @name?
How to open a file in Ruby?
What is yield in ruby?
What must you do first before you can invoke an unboundmethod object?
What are the looping structures available in ruby?