refactor cprs (rsync) for ACL and using sudo
parent
ca7d7a5a0d
commit
256186376d
|
@ -3,11 +3,14 @@
|
||||||
# present working directory to supplied destination
|
# present working directory to supplied destination
|
||||||
module_load confirm
|
module_load confirm
|
||||||
function cprs () {
|
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
|
[ $# -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
|
[ ! -d "$1" ] && echo source: $1 is not a directory && return 1
|
||||||
[ ! -d "$2" ] && echo destination: $2 is not a directory && return 1
|
cmd="$usesudo rsync --exclude *[C]ache* --exclude node_modules --progress -aAru $1 $2"
|
||||||
echo Command to run: rsync --progress -a -r -u "$1" "$2"
|
echo $cmd
|
||||||
confirm Do you want to start the rsync copy? || return 0
|
confirm Do you want to start the rsync copy? || return 0
|
||||||
echo copying.....
|
echo copying.....
|
||||||
rsync --exclude *[C]ache* --progress -a -r -u "$1" "$2"
|
eval $cmd
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue