Walk a directory/Recursively: Difference between revisions
Content added Content deleted
(Added zkl) |
(added the java 8 version) |
||
Line 974: | Line 974: | ||
} |
} |
||
}</lang> |
}</lang> |
||
{{works with|Java|8+}} |
|||
<lang java>import java.io.IOException; |
|||
import java.nio.file.*; |
|||
public class WalkTree { |
|||
public static void main(String[] args) throws IOException { |
|||
Path start = FileSystems.getDefault().getPath("/path/to/file"); |
|||
Files.walk(start) |
|||
.filter( path -> path.toFile().isFile()) |
|||
.filter( path -> path.toString().endsWith(".mp3")) |
|||
.forEach( System.out::println ); |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |