Get names of all files from a folder with Ruby

Željko Filipin picture Željko Filipin · Nov 18, 2009 · Viewed 254.2k times · Source

I want to get all file names from a folder using Ruby.

Answer

Ian Eccles picture Ian Eccles · Nov 18, 2009

You also have the shortcut option of

Dir["/path/to/search/*"]

and if you want to find all Ruby files in any folder or sub-folder:

Dir["/path/to/search/**/*.rb"]