-4

How can I display the file listing of a local directory in a Ruby On Rails application?

thomasfedb
  • 5,990
  • 2
  • 37
  • 65
  • Content? What do you mean? List of files? – Sergio Tulentsev Jan 24 '14 at 12:16
  • 2
    Stackoverflow has answers to most basic questions. As a rule of thumb, you should search for an answer before asking =) http://stackoverflow.com/questions/2512254/iterate-through-every-file-in-one-directory has plenty of answers :-) – Abdo Jan 24 '14 at 12:23

1 Answers1

1

Give this a shot:

Dir.foreach("/path/to/your/dir") { |file|
        puts file
}
Abdo
  • 13,549
  • 10
  • 79
  • 98
Walid Da.
  • 948
  • 1
  • 7
  • 15