Java tutorial
import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws Exception { Path start = Paths.get("c:/Java_Dev/"); int maxDepth = 5; Files.find(start, maxDepth, (path, attr) -> String.valueOf(path).endsWith("xls")).sorted() .forEach(System.out::println); } }