Lennie
Lennie

Reputation: 2069

Ruby -> get all files in directories

I want to get a list of all files in a directory that contain multiple sub-directories (and possible more sub-directories within them)

How can I do this using Ruby on my Mac OS X?

Thanks

Upvotes: 3

Views: 789

Answers (1)

Paweł Obrok
Paweł Obrok

Reputation: 23164

Something like this should work

Dir["**/*"].select{|x| !File.directory?(x)}

Upvotes: 4

Related Questions