Listing A Directory : Dir.entries « File Directory « Ruby






Listing A Directory


p Dir.entries('mydir')
Dir.foreach('mydir') { |x| puts x if x != "." && x != ".."}

 

Related examples in the same category

1.Dir.entries contains all the entries found in a directory
2.get a list of the files and directories within a specific directory using Dir.entries: