Reading files in a Dir

Hello,
How can I read files form a directory? I basically just want to print
out a list of filenames in a particular directory.

Thanks,

  • Jeff M.

Use the built-in Dir class.

http://ruby-doc.org/core/classes/Dir.html

Check out the ‘entries’ method.

That should get you started.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs