获取文件路径下 所有的文件以及文件夹
public void getList(String patha){
String path=patha;
File file=new File(path);
File[] tempList = file.listFiles();
System.out.println("该目录下对象个数:"+tempList.length);
List<Map<String, String>> list = new ArrayList<Map<String,String>>();
for (int i = 0; i < tempList.length; i++) {
if (tempList[i].isFile()) {
pathList.add(tempList[i].getPath());
System.out.println("文 件:"+tempList[i].getPath());
}
if (tempList[i].isDirectory()) {
System.out.println("文件夹:"+tempList[i].getPath());
//递归:
getList(tempList[i].getPath());
}
}
}