1public void listFilesForFolder(final File folder) {
2 for (final File fileEntry : folder.listFiles()) {
3 if (fileEntry.isDirectory()) {
4 listFilesForFolder(fileEntry);
5 } else {
6 System.out.println(fileEntry.getName());
7 }
8 }
9}
10
11final File folder = new File("/home/you/Desktop");
12listFilesForFolder(folder);
13