- long lineCount = Files.walk(Paths.get(path)).filter(Files::isRegularFile).filter(p -> p.toString().endsWith('.' + filetype))
- .flatMap((Function<Path, Stream<String>>) p ->
+ Set<Path> excludedDirectoryPaths = Arrays.stream(excludedDirectoryNames).map(Paths::get).collect(Collectors.toSet());
+ AtomicLong lineCount = new AtomicLong();
+ AtomicLong byteSize = new AtomicLong();
+ AtomicLong fileCount = new AtomicLong();
+ Files.walk(Paths.get(path)).filter(Files::isRegularFile).filter(p -> p.toString().endsWith('.' + filetype))
+ .filter(p -> !StreamSupport.stream(p.spliterator(), false).anyMatch(excludedDirectoryPaths::contains)).forEach(p ->