This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/cp.sh

25 lines
492 B
Bash
Raw Normal View History

2023-08-08 16:24:15 +03:00
# replace default cp with rsync.
2023-12-07 01:44:42 +03:00
function cp() {
2023-12-07 00:42:06 +03:00
rsync -ahP --chmod=u+w -- "${@}"
}
2023-08-08 16:24:15 +03:00
# copy and also merge all changes (delete dst files that do not exist in src).
2023-12-07 01:44:42 +03:00
function cp_merge() {
2023-12-07 00:42:06 +03:00
rsync -ahP --chmod=u+w --delete -- "${@}"
}
2023-08-08 16:24:15 +03:00
# copy by creating hardlinks.
2023-12-07 01:44:42 +03:00
function cp_link() {
2023-12-07 00:42:06 +03:00
/usr/bin/cp -lr -- "${@}"
}
2023-08-08 16:24:15 +03:00
# default cp, a.k.a builtin cp.
2023-12-07 01:44:42 +03:00
function bcp() {
2023-12-07 00:42:06 +03:00
/usr/bin/cp "${@}"
}
# cp_merge without writing anything.
2023-12-07 01:44:42 +03:00
function cp_test() {
2023-12-07 00:42:06 +03:00
rsync -ahP --chmod=u+w --delete -n -- "${@}"
}