Cp : Add rcp fast and hash.

This commit is contained in:
Dmitry Voronin 2024-06-04 14:55:38 +03:00
parent 63713c335b
commit 5b39eb3ab8
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -6,6 +6,20 @@
rsync -ahP --chmod=u+w "''${@}"
}
# Replaces default cp with rsync.
# Only compare file size.
# Usage: rcp_fast <FROM> <TO>
function rcp_fast() {
rsync -ahP --chmod=u+w --size-only "''${@}"
}
# Replaces default cp with rsync.
# Compare file hashes.
# Usage: rcp_hash <FROM> <TO>
function rcp_hash() {
rsync -ahP --chmod=u+w --checksum "''${@}"
}
# Copy and also merge all changes (delete dst files that do not exist in src).
# Usage: rcp_merge <FROM> <TO>
function rcp_merge() {
@ -24,17 +38,17 @@
rsync -ahP --chmod=u+w --delete --checksum "''${@}"
}
# Print output of cp_merge without writing anything.
# Usage: rcp_test <FROM> <TO>
function rcp_test() {
rsync -ahP --chmod=u+w --delete -n "''${@}"
}
# Copy by creating hardlinks.
# Works for directories, too.
# Usage: cp_link <FROM> <TO>
function cp_link() {
/usr/bin/env cp -lr "''${@}"
}
# Print output of cp_merge without writing anything.
# Usage: rcp_test <FROM> <TO>
function rcp_test() {
rsync -ahP --chmod=u+w --delete -n "''${@}"
}
'';
}