Esempio n. 1
0
 public static void main(String[] args) {
   // Path startingDir = FileSystems.getDefault().getPath("/home/neko/NetBeansProjects/Default");
   Path startingDir = FileSystems.getDefault().getPath(args[0]);
   ex_4_3_13_FileTree pf = new ex_4_3_13_FileTree();
   try {
     Files.walkFileTree(startingDir, pf);
   } catch (IOException ex) {
     System.out.println(ex);
   }
 }
  /** Prints the structure for a given directory or file */
  public static void main(String[] args) throws IOException {
    if (args.length != 1) {
      printUsage();
      System.exit(-1);
    }

    String pathName = args[0];
    Path startingDir = Paths.get(pathName);

    PrintDirectoryStructureWithVisitor pdsv = new PrintDirectoryStructureWithVisitor();
    Files.walkFileTree(startingDir, pdsv);
  }