private void copyFile(File target, File source) throws IOException {
    if (!target.getParentFile().exists()) {
      LOGGER.error("Copy target dir {} doesn't exist", target.getParentFile());
    }
    if (!source.exists()) {
      LOGGER.error("Copy source file {} doesn't exist", source);
    }
    Files.deleteIfExists(target.toPath());
    Files.copy(source.toPath(), target.toPath());
    snapshotLogger.logFile(source);
  }
For "source file not exists" problem (jira787) debugging
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/snapshot/SnapshotTaker.java