//定义文件夹路径 wordPath为文件夹的路径
File filedir = new File(wordPath);
File[] tempList = filedir.listFiles();
System.out.println("该目录下对象个数:"+tempList.length);
for (int i = 0; i < tempList.length; i++) {
if (tempList[i].isFile()) {
Map<String,Object> filesMap=new HashMap<String, Object>();
filesMap.put("fileUrl", tempList[i].toString().replaceAll("\\\\", "/"));
filesMap.put("fileName", tempList[i].getName().toString().replaceAll("\\\\", "/"));
//拼接一个对象集合
filesToMerge.add(filesMap);
//for循环输出url
System.out.println(tempList[i].toString().replaceAll("\\\\", "/"));
}
}
System.out.println(filesToMerge);