#!/bin/bash copyFolder() { local folder="$1" local folder_name=$(basename "$folder") local save_dir="$2" local user_name="$3" # advisory — the destination path determines the owner # Write as the destination's owner — no root, no chown (see copyFile). local op="runInstallOp" [[ "$save_dir" == "$containers_dir"* || "$save_dir" == /docker/containers/* ]] && op="runFileOp" local result=$($op cp -rf "$folder" "$save_dir") checkSuccess "Copying $folder_name to $save_dir" }