private static int runExportSnapshot(final Configuration conf, final String sourceSnapshotName,
    final String targetSnapshotName, final Path srcDir, Path rawTgtDir, final boolean overwrite,
    final boolean resetTtl, final boolean checksumVerify, final boolean noSourceVerify,
    final boolean noTargetVerify) throws Exception {
    FileSystem tgtFs = rawTgtDir.getFileSystem(conf);
    FileSystem srcFs = srcDir.getFileSystem(conf);
    Path tgtDir = rawTgtDir.makeQualified(tgtFs.getUri(), tgtFs.getWorkingDirectory());
    LOG.info("tgtFsUri={}, tgtDir={}, rawTgtDir={}, srcFsUri={}, srcDir={}", tgtFs.getUri(), tgtDir,
      rawTgtDir, srcFs.getUri(), srcDir);
    List<String> opts = new ArrayList<>();
    opts.add("--snapshot");
    opts.add(sourceSnapshotName);
    opts.add("--copy-to");
    opts.add(tgtDir.toString());
    if (!targetSnapshotName.equals(sourceSnapshotName)) {
      opts.add("--target");
      opts.add(targetSnapshotName);
    }
    if (overwrite) {
      opts.add("--overwrite");
    }
    if (resetTtl) {
      opts.add("--reset-ttl");
    }
    if (!checksumVerify) {
      opts.add("--no-checksum-verify");
    }
    if (!noSourceVerify) {
      opts.add("--no-source-verify");
    }
    if (!noTargetVerify) {
      opts.add("--no-target-verify");
    }

    // Export Snapshot
    return run(conf, new ExportSnapshot(), opts.toArray(new String[opts.size()]));
  }
Creates destination directory, runs ExportSnapshot() tool, and runs some verifications.
hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java