public static File copyFile(File sourceFile, File targetFile) throws IOException {
    if (!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs()) {
      synchronized (FileUtils.class) {
        if (!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs()) {
          throw new IOException(
              String.format(
                  "failed to copy file %s to %s: failed to create parent dir %s",
                  sourceFile.getPath(),
                  targetFile.getPath(),
                  targetFile.getParentFile().getPath()));
        }
      }
    }

    Files.copy(sourceFile.toPath(), targetFile.toPath());
    return targetFile;
  }
Move source file to target file. The move will be divided into three steps: 1. Copy the source
file to the "target.unfinished" location 2. Rename the "target.unfinished" to "target" 3.
Delete the source file

@param source source file, which can be a directory.
@param target target file, which can be a directory.
@return success or not
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/FileUtils.java