java实现获取文件夹下所有文件的路径
public static List getFilePath(String folderPath) {
File folder = new File(folderPath);
List filePathList = new ArrayList<>();
String rootPath;
if (folder.exists()) {
String[] fileNameList = folder.list();
if (null != fileNameList && fileNameList.length > 0) {
if (folder.getPath().endsWith(File.separator)) {
rootPath = folder.getPath();
} else {
rootPath = folder.getPath() + File.separator;
}
for (String fileName : fileNameList) {
filePathList.add(rootPath + fileName);
}
}
}
return filePathList;
}



