static void listDir(File dir) { printHelper(dir, ""); } static void printHelper(File dir, String blank) { File[] fs = dir.listFiles(); if (fs != null) { for (File f : fs) { if (f.isFile()) { System.out.println(blank + f.getName()); } else { System.out.println(blank + f.getName() + "\\"); printHelper(f, blank + " "); } } } }
Sign in to make a reply
Deler