shell-base/function/rsync

14 lines
559 B
Plaintext
Raw Normal View History

#!/bin/bash
# simple copy using rsync. Preserves everything
# present working directory to supplied destination
module_load confirm
function cprs () {
[ $# -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 "$2" ] && echo destination: $2 is not a directory && return 1
echo Command to run: rsync --progress -a -r -u "$1" "$2"
confirm Do you want to start the rsync copy? || return 0
echo copying.....
rsync --progress -a -r -u "$1" "$2"
}