public class PrintFile{ public static void main(String[] args) { Path path = Paths.get("D:\\", "", "test"); System.out.println(path); File f = path.toFile(); getFiles(f); } public static void getFiles(File file){ File[] ff = file.listFiles(); for(File b : ff){ if(b.isDirectory()){ System.out.println(b.getName() + "\\"); getFiles(b); }else{ System.out.println(b.getName()); } } }}
Sign in to make a reply
小旭zy