79497830

Date: 2025-03-10 11:30:48
Score: 0.5
Natty:
Report link

Answering my own question. There were several issues with the previous code. This works:

#!/bin/bash
STAMP=$(date '+%0d-%0m-%0y-%0kH%0M')
rsync  -aAXv --prune-empty-dirs  --dry-run \
 --include='*/' \
 --include='/scripts/***' \
 --exclude='/Documents/sueMagic/***' \
 --include='/Documents/***' \
 --exclude='*' \
 --log-file="/run/media/maurice/TO2-LIN-1TB/backup/logs/linuxHomeBackupSlim-$STAMP.log" \
 /home/maurice/ /run/media/maurice/TO2-LIN-1TB/backup/linuxHomeBackupSlim 

I suppressed the R (relative) option. Patterns are anchored at the root of the transfer with a leading / and the source directory is also ending with a slash. The initial include will traverse the whole tree and the final exclude '*' eliminates everything in the currently examined directory that has not be included previously. Empty directories are pruned.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: mauricebis