public static boolean runDistCp(List<Path> srcPaths, Path dst, Configuration conf)
      throws IOException {
    DistCpOptions options = new DistCpOptions.Builder(srcPaths, dst)
        .withSyncFolder(true)
        .withCRC(true)
        .preserve(FileAttribute.BLOCKSIZE)
        .build();

    // Creates the command-line parameters for distcp
    List<String> params = constructDistCpParams(srcPaths, dst, conf);

    try {
      conf.setBoolean("mapred.mapper.new-api", true);
      DistCp distcp = new DistCp(conf, options);

      // HIVE-13704 states that we should use run() instead of execute() due to a hadoop known issue
      // added by HADOOP-10459
      if (distcp.run(params.toArray(new String[params.size()])) == 0) {
        return true;
      } else {
        return false;
      }
    } catch (Exception e) {
      throw new IOException("Cannot execute DistCp process: ", e);
    } finally {
      conf.setBoolean("mapred.mapper.new-api", false);
    }
  }
Check the permissions on a file
@param fs Filesystem the file is contained in
@param stat Stat info for the file
@param action action to be performed
@param ugi user group info for the current user.  This is passed in so that tests can pass
           in mock ones.
@throws IOException If thrown by Hadoop
@throws AccessControlException if the file cannot be accessed
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/HdfsUtils.java