Java/JSP/File List
Index of Files
<%@ page import="java.io.*" %>
<HTML>
<HEAD>
<TITLE>Index of Files</TITLE>
</HEAD>
<BODY>
<H1>Index of Files</H1>
<%
String file = application.getRealPath("/");
File f = new File(file);
String [] fileNames = f.list();
File [] fileObjects= f.listFiles();
%>
<UL>
<%
for (int i = 0; i < fileObjects.length; i++) {
if(!fileObjects[i].isDirectory()){
%>
<LI>
(<%= Long.toString(fileObjects[i].length()) %> bytes long)
<%
}
}
%>
</UL>
</BODY>
</HTML>