Compare commits
No commits in common. "4a76b5440c0ce8352f842cb2695cacef15c2e89f" and "b6568cf4710021641975aec2c51affd3f4a094b0" have entirely different histories.
4a76b5440c
...
b6568cf471
12
icp
12
icp
|
|
@ -4,11 +4,9 @@ usage() {
|
|||
echo >&2 "Copy like cp, but use rsync in the background."
|
||||
echo >&2 "Options:"
|
||||
echo >&2 " -h print this help message"
|
||||
echo >&2 " -L follow symlinks in source"
|
||||
echo >&2 " -n no-clobber, do not overwrite existing files"
|
||||
echo >&2 " -n print rsync command and perform a dry-run"
|
||||
echo >&2 " -r copy directories recursively"
|
||||
echo >&2 " -v verbose output"
|
||||
echo >&2 " --dry-run print rsync command and perform a dry-run"
|
||||
echo >&2 "Positional arguments:"
|
||||
echo >&2 " SOURCE file/directory to copy"
|
||||
echo >&2 " DEST target directory or filename (if only one SOURCE)"
|
||||
|
|
@ -23,7 +21,7 @@ EXIT_INVALID_PATH=3 # rsync: Errors selecting input/output files, dirs
|
|||
# -remove trailing slash from directories
|
||||
flag_recursive=0
|
||||
flag_dryrun=0
|
||||
rsync_opt=("-lpgoD")
|
||||
rsync_opt=("-lptgoD")
|
||||
rsync_arg=()
|
||||
for arg in "$@"
|
||||
do
|
||||
|
|
@ -33,13 +31,9 @@ do
|
|||
elif [[ "$arg" == "-r" ]];then
|
||||
flag_recursive=1
|
||||
rsync_opt+=("-r")
|
||||
elif [[ "$arg" == "-L" ]];then
|
||||
rsync_opt+=("-L")
|
||||
elif [[ "$arg" == "-v" ]];then
|
||||
rsync_opt+=("-v")
|
||||
elif [[ "$arg" == "-n" ]];then
|
||||
rsync_opt+=("--ignore-existing")
|
||||
elif [[ "$arg" == "--dry-run" ]];then
|
||||
flag_dryrun=1
|
||||
rsync_opt+=("-nv")
|
||||
elif [[ -f "$arg" ]];then
|
||||
|
|
@ -71,7 +65,7 @@ fi
|
|||
# If this is not a dry-run, add a nice overall
|
||||
# progress bar
|
||||
if [[ "$flag_dryrun" -eq 0 ]]; then
|
||||
rsync_opt+=("--info=progress2 --no-inc-recursive")
|
||||
rsync_opt+=("--info=progress2")
|
||||
fi
|
||||
|
||||
# Construct command
|
||||
|
|
|
|||
Loading…
Reference in New Issue