31 lines
668 B
Bash
31 lines
668 B
Bash
# Replaces default cp with rsync.
|
|
# Usage: cp <FROM> <TO>
|
|
function cp() {
|
|
rsync -ahP --chmod=u+w "${@}"
|
|
}
|
|
|
|
# Copy and also merge all changes (delete dst files that do not exist in src).
|
|
# Usage: cp_merge <FROM> <TO>
|
|
function cp_merge() {
|
|
rsync -ahP --chmod=u+w --delete "${@}"
|
|
}
|
|
|
|
# Copy by creating hardlinks.
|
|
# Works for directories, too.
|
|
# Usage: cp_link <FROM> <TO>
|
|
function cp_link() {
|
|
/usr/bin/cp -lr "${@}"
|
|
}
|
|
|
|
# Default cp, a.k.a builtin cp.
|
|
# When you don't need rsync.
|
|
function bcp() {
|
|
/usr/bin/cp "${@}"
|
|
}
|
|
|
|
# Print output of cp_merge without writing anything.
|
|
# Usage: cp_test <FROM> <TO>
|
|
function cp_test() {
|
|
rsync -ahP --chmod=u+w --delete -n "${@}"
|
|
}
|