Iterate over a directory printing subdirectories in it

suggest change
public void iterate(final String dirPath) throws IOException {
    try (DirectoryStream<Path> paths = Files.newDirectoryStream(Paths.get(dirPath))) {
      for (final Path path : paths) {
        if (Files.isDirectory(path)) {
          System.out.println(path.getFileName());
        }
      }
    }
  }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents