Advertisement
cd62131

ChildPaths

Mar 4th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.47 KB | None | 0 0
  1. import java.nio.file.DirectoryStream;
  2. import java.nio.file.Files;
  3. import java.nio.file.Path;
  4. import java.nio.file.Paths;
  5.  
  6. public class ChildPaths {
  7.   public static void main(String[] args) {
  8.     Path dir = Paths.get(args[0]);
  9.     try (DirectoryStream<Path> dirs = Files.newDirectoryStream(dir)) {
  10.       for (Path path: dirs) {
  11.         if (Files.isRegularFile(path)) {
  12.           System.out.println(path);
  13.         }
  14.       }
  15.     }
  16.     catch (Exception e) {
  17.     }
  18.   }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement