Reading files in a Dir

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


  • Jeff M.

Use the built-in Dir class.

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