标签:tab direct abs tor ring null path 读取 add
采用递归的方式,逐层读取目录下的文件
public void getFile(String path, List<String> fileList) {
File file = new File(path);
if (file.isDirectory()) {
File[] files = file.listFiles();
if (files != null) {
for (File subFile : files) {
getFile(subFile.getPath(), fileList);
}
}
} else {
fileList.add(file.getAbsolutePath());
}
}
标签:tab direct abs tor ring null path 读取 add
原文地址:https://www.cnblogs.com/tulip20/p/12305407.html