Recursively list files in Java

Java 8 provides a nice stream to process all files in a tree. Files.walk(Paths.get(path)) .filter(Files::isRegularFile) .forEach(System.out::println); This provides a natural way to traverse files. Since it’s a stream you can do all nice stream operations on the result such as limit, grouping, mapping, exit early etc. UPDATE: I might point out there is also Files.find … Read more