Code Explainers

Code explainers tagged #file-traversal

java
public List<Path> expandGlob(Path baseDir, String glob) throws IOException {
    FileSystem fs = baseDir.getFileSystem();
    PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
    boolean recursive = glob.contains("**");

Expanding glob patterns with NIO

glob-matching nio streams
Intermediate 5 steps