public class PathAll {
private static void pathall(String path){
File file = new File(path);
File[] fs =file.listFiles();
if (fs==null){
System.out.println("不存在");
return;
}
for (File f:fs) {
if (f.isFile()){
System.out.println(f.getPath());
}else {
pathall(f.getPath());
}
}
}
public static void main(String[] args) {
String dir ="F:\\Downloads\\笔记";
pathall(dir);
}
}