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
577 B
Bash
Raw Normal View History

2023-12-07 04:02:47 +03:00
# Replaces default cp with rsync.
2024-01-29 04:12:31 +03:00
# Usage: rcp <FROM> <TO>
function rcp() {
2023-12-24 16:03:10 +03:00
rsync -ahP --chmod=u+w "${@}"
2023-12-07 00:42:06 +03:00
}
2023-08-08 16:24:15 +03:00
2023-12-07 04:02:47 +03:00
# Copy and also merge all changes (delete dst files that do not exist in src).
2024-01-29 04:12:31 +03:00
# Usage: rcp_merge <FROM> <TO>
function rcp_merge() {
2023-12-24 16:03:10 +03:00
rsync -ahP --chmod=u+w --delete "${@}"
2023-12-07 00:42:06 +03:00
}
2023-08-08 16:24:15 +03:00
2023-12-07 04:02:47 +03:00
# Copy by creating hardlinks.
# Works for directories, too.
# Usage: cp_link <FROM> <TO>
2023-12-07 01:44:42 +03:00
function cp_link() {
2024-01-27 18:38:18 +03:00
/usr/bin/env cp -lr "${@}"
2023-12-07 00:42:06 +03:00
}
2023-08-08 16:24:15 +03:00
2023-12-07 04:02:47 +03:00
# Print output of cp_merge without writing anything.
2024-01-29 04:12:31 +03:00
# Usage: rcp_test <FROM> <TO>
function rcp_test() {
2023-12-24 16:03:10 +03:00
rsync -ahP --chmod=u+w --delete -n "${@}"
2023-12-07 00:42:06 +03:00
}