How can I get list all the files within a folder recursively in Java?
public static void directory(File dir) { File[] files = dir.listFiles(); for (File file : files) { System.out.println(file.getAbsolutePath()); if (file.listFiles() != null) directory(file); } }
Here dir is Directory to be scanned. e.g. c:\
dir
c:\