读取指定文件夹限定文件
File reportDirectory = new File (...);
reportDirectory是目录...
File[] files = reportDirectory.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.startsWith("OFFICE_PERMISSION_REPORT_"+folder.getOfficeName()+"_")
&& name.endsWith(".xls");
}
});
Arrays.sort(files);
ArrayList<File> fileList = new ArrayList<File>();
fileList.addAll(Arrays.asList(files));
Collections.reverse(fileList);
ModelAndView result = new ModelAndView("PermissionReportList").addObject(ServletData.MODELANDVIEW_OBJECT,fileList).addObject("officeName", folder.getOfficeName());
return result;