/**
* 读取文件夹下所有文件
*/
private List readfile(String filepath) throws FileNotFoundException,
IOException {
List fileNameList = new ArrayList();
try {
File file = new File(filepath);
if (!file.isDirectory()) {
fileNameList.add(file.getName());
} else if (file.isDirectory()) {
String[] filelist = file.list();
for (int i = 0; i < filelist.length; i++) {
File readfile = new File(filepath + "\\" + filelist[i]);
if (!readfile.isDirectory()) {
fileNameList.add(readfile.getName());
} else if (readfile.isDirectory()) {
readfile(filepath + "\\" + filelist[i]);
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
System.out.println("readfile() Exception:" + e.getMessage());
}
return fileNameList;
}