I have to following code in ruby:
<%
files = Dir.glob('/**/*')
files.each do |file|
puts file
end
%>
It outputs (for example):
/dirA/file1.txt
/dirA/file2.txt
/dirB/file1.txt
/file1.txt
/file2.txt
/subdirA/file1.txt
I want it to output it like this:
/file1.txt
/file2.txt
/dirA/file1.txt
/dirA/file2.txt
/dirB/file1.txt
/subdirA/file1.txt
Basically, I'd like to have the files displayed before the directories. Is there a sorting command I can use?