shell-base/function/rsync

17 lines
578 B
Bash
Executable File

#!/bin/bash
# simple copy using rsync. Preserves everything
# present working directory to supplied destination
module_load confirm
function cprs () {
local usesudo
local cmd
[[ $1 == "-s" ]] && usesudo='sudo' && shift
[ $# -ne 2 ] && echo two directories source and destination need to be passed && return 1
[ ! -d "$1" ] && echo source: $1 is not a directory && return 1
cmd="$usesudo rsync --exclude *[C]ache* --exclude node_modules --progress -aAru $1 $2"
echo $cmd
confirm Do you want to start the rsync copy? || return 0
echo copying.....
eval $cmd
}