public static void copyFile()

in bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/utils/linux/LinuxFileUtils.java [211:235]


    public static void copyFile(String source, String dest) {
        if (StringUtils.isBlank(source) || StringUtils.isBlank(dest)) {
            log.error("source and dest must not be empty");
            return;
        }

        log.info("Copy file: [{}] to [{}]", source, dest);
        List<String> builderParameters = new ArrayList<>();
        builderParameters.add("cp");
        if (Files.exists(Path.of(source)) && Files.isDirectory(Paths.get(source))) {
            builderParameters.add("-r");
        }

        builderParameters.add(source);
        builderParameters.add(dest);

        try {
            ShellResult shellResult = sudoExecCmd(builderParameters);
            if (shellResult.getExitCode() != MessageConstants.SUCCESS_CODE) {
                throw new StackException(shellResult.getErrMsg());
            }
        } catch (IOException e) {
            throw new StackException(e);
        }
    }