aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-16 18:30:56 +0200
committerDanilo M. <danix@danix.xyz>2026-06-16 18:30:56 +0200
commitd9a245ec8c2236e897771459467a8c7c753ce341 (patch)
tree8a04681da1da96110093f7f8ab199aca5e375dcf
parentcaf279a0fc72e0897bfeaa91b62eea9600b43a62 (diff)
downloaddots-backup-d9a245ec8c2236e897771459467a8c7c753ce341.tar.gz
dots-backup-d9a245ec8c2236e897771459467a8c7c753ce341.zip
feat: add --delete to dir rsync so backup mirrors source
Removed/moved files in backed-up directories are now pruned from the backup instead of accumulating. Applies only to directory copies, not the per-file branch or restore. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-xdot-backup.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/dot-backup.sh b/dot-backup.sh
index 34558ca..701153f 100755
--- a/dot-backup.sh
+++ b/dot-backup.sh
@@ -200,9 +200,9 @@ do_rsync() {
if [[ "$is_dir" == true ]]; then
mkdir -p "$dst"
if [[ "$VERBOSE" == true ]]; then
- rsync -av "$src/" "$dst/"
+ rsync -av --delete "$src/" "$dst/"
else
- rsync -a "$src/" "$dst/" && echo -e "\t ${GREEN}Copied${NC}"
+ rsync -a --delete "$src/" "$dst/" && echo -e "\t ${GREEN}Copied${NC}"
fi
else
mkdir -p "$(dirname "$dst")"