boolean copyUsingDistCpSnapshots(Path sourcePath, Path targetPath, UserGroupInformation proxyUser,
      HiveConf clonedConf) throws IOException {

    DistributedFileSystem targetFs = SnapshotUtils.getDFS(targetPath, clonedConf);
    boolean result = false;
    if (getWork().getCopyMode().equals(SnapshotUtils.SnapshotCopyMode.DIFF_COPY)) {
      LOG.info("Using snapshot diff copy for source: {} and target: {}", sourcePath, targetPath);
      boolean overwriteTarget = clonedConf.getBoolVar(REPL_SNAPSHOT_OVERWRITE_TARGET_FOR_EXTERNAL_TABLE_COPY);
      LOG.debug("Overwrite target in case the target location is modified is turned {}",
          overwriteTarget ? "on" : "off");
      result = FileUtils
          .distCpWithSnapshot(firstSnapshot(work.getSnapshotPrefix()), secondSnapshot(work.getSnapshotPrefix()),
              Collections.singletonList(sourcePath), targetPath, overwriteTarget, clonedConf,
              ShimLoader.getHadoopShims(), proxyUser);
       if(result) {
         // Delete the older snapshot from last iteration.
         targetFs.deleteSnapshot(targetPath, firstSnapshot(work.getSnapshotPrefix()));
       } else {
         throw new SnapshotException(
             "Can not successfully copy external table data using snapshot diff. source: " + sourcePath + " and "
                 + "target: " + targetPath);
       }
    } else if (getWork().getCopyMode().equals(SnapshotUtils.SnapshotCopyMode.INITIAL_COPY)) {
      LOG.info("Using snapshot initial copy for source: {} and target: {}", sourcePath, targetPath);
      // Get the path relative to the initial snapshot for copy.
      Path snapRelPath =
          new Path(sourcePath, HdfsConstants.DOT_SNAPSHOT_DIR + "/" + secondSnapshot(work.getSnapshotPrefix()));

      // This is the first time we are copying, check if the target is snapshottable or not, if not attempt to allow
      // snapshots.
      SnapshotUtils.allowSnapshot(targetFs, work.getFullyQualifiedTargetPath(), clonedConf);
      // Attempt to delete the snapshot, in case this is a bootstrap post a failed incremental, Since in case of
      // bootstrap we go from start, so delete any pre-existing snapshot.
      SnapshotUtils.deleteSnapshotIfExists(targetFs, targetPath, firstSnapshot(work.getSnapshotPrefix()), clonedConf);

      // Copy from the initial snapshot path.
      result = runFallbackDistCp(snapRelPath, targetPath, proxyUser, clonedConf);
    }

    // Create a new snapshot at target Filesystem. For the next iteration.
    if (result) {
      SnapshotUtils.createSnapshot(targetFs, targetPath, firstSnapshot(work.getSnapshotPrefix()), clonedConf);
    }
    return result;
  }
DirCopyTask, mainly to be used to copy External table data.
ql/src/java/org/apache/hadoop/hive/ql/exec/repl/DirCopyTask.java