遍历目录下所有文件,我们先利用了application.getRealPath读取根目录文件,然后再利用 new file读取目录文件再保存到数组,最后用for遍历输出。
Index of FilesIndex of Files
Click a file to open/download it...
String file = application.getRealPath("/");
File file1 = new File(file);
String [] fileNames = file1.list();
File [] fileObjects= file1.listFiles();
%>
for (int i = 0; i < fileObjects.length; i ) {
if(!fileObjects[i].isDirectory()){
%>
( bytes long)
}
}
%>