S
Sfdesigner Sfdesigner
Currently I'm using this code to output a list of files to a .rhtml
page:
<%
Dir.foreach("/") do |file|
next if File.fnmatch('*.*', file)
puts '<a href="file">' + file + '</a>'
end
%>
This removes files from the list output such as 'photo.jpg'.
But it leaves the files with names like '.htaccess', ',' and '..'.
I could create more of the 'next' statements explicitly for those file
and directory names but wondering if there's a more elegant way to say
don't output files with a '.' in their names.
page:
<%
Dir.foreach("/") do |file|
next if File.fnmatch('*.*', file)
puts '<a href="file">' + file + '</a>'
end
%>
This removes files from the list output such as 'photo.jpg'.
But it leaves the files with names like '.htaccess', ',' and '..'.
I could create more of the 'next' statements explicitly for those file
and directory names but wondering if there's a more elegant way to say
don't output files with a '.' in their names.