Ejemplo n.º 1
0
  /**
   * Method find files for display result
   *
   * @return List<FileFound>
   */
  public List<FileFound> find() {

    // check on exist all arguments for copy
    if (args.length < 3
        || args[1] == null
        || args[1].isEmpty()
        || args[2] == null
        || args[2].isEmpty()) {

      Error error = ef.getError("cli", 0);
      error.show();
      System.exit(0);
    }

    Path pathSource = Paths.get(args[1]);

    Boolean folderIsExist = Files.exists(pathSource);

    if (!folderIsExist) {

      Error error = ef.getError("cli", 1);
      error.show();
      System.exit(0);
    }

    return finder.findByParams(pathSource, args[2]);
  }
Ejemplo n.º 2
0
  /**
   * Method for start find and copy process
   *
   * @return int
   */
  public int copy() {

    // check on exist all arguments for copy
    if (args.length != 4
        || args[2] == null
        || args[2].isEmpty()
        || args[3] == null
        || args[3].isEmpty()) {

      Error error = ef.getError("cli", 0);
      error.show();
      System.exit(0);
    }

    return copyFiles.copyFilesByPath(
        finder.findByParams(Paths.get(args[1]), args[3]), Paths.get(args[2]));
  }