public static Result copyFile(String srcFile, String destFile, boolean force, boolean sudo) throws IOException, InterruptedException {
    ArrayList<String> command = new ArrayList<>();

    if (WINDOWS) {
      command.add("copy");

      if (force) {
        command.add("/Y"); // force overwrite
      }
    } else {
      command.add("cp");
      command.add("-p"); // preserve mode, ownership, timestamps

      if (force) {
        command.add("-f"); // force overwrite
      }
    }

    command.add(srcFile);
    command.add(destFile);

    return runCommand(command, null, null, sudo);
  }
Copies a source file to the specified destination.

@param srcFile  the path to the source file
@param destFile the path to the destination file
@param force    true to force copy even if the file exists
@param sudo     true to execute the command using sudo (ambari-sudo); otherwise false
@return the shell command result
ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java