■ space · the safety net
Dry-run by default, an explicit arm step, and a backup net — the generator refuses to emit a bare --delete.
The net is two flags — --backup --backup-dir=DEST/_rsync_backup_$(date +%F) — and rsync moves every file it would have deleted into that dated folder instead of erasing it.
Paths, remote host, excludes and bandwidth limits in; a paste-ready command out. Nothing you type leaves the page.
WHY --DELETE DESERVES A WARNING
Because rsync's contract is make the destination match the source, and --delete extends it to removals. The man page: "delete extraneous files from the destination dir."
Extraneous = anything the source doesn't have — including things missing because you pointed at the wrong source, mounted the wrong USB stick, or typo'd a path.
One page-one generator even labels its output "AI-generated and not yet checked for validity" — above a delete command. The four flags that do the real damage:
| flag | what it does | what it does when you're wrong |
|---|---|---|
--delete | destination files missing from source get removed | wrong source path → destination files "extraneous" → gone |
src/ vs src | trailing slash copies the contents; no slash copies the directory itself | one character, entirely different destination layout |
-a | archive: recursive + permissions, times, owners, symlinks | skipped → a "backup" that silently isn't one |
--partial | keep half-transferred files on interruption | flaky link → restart the whole transfer from zero |
The trailing-slash row is the classic. rsync's docs say a trailing slash on the source "changes this behavior to avoid creating an extra directory at the destination."
Plainly: src/ pours the contents into the destination; src creates dest/src and pours them in there. Two characters.
The machine below shows which sentence applies as you type — the trailing slash has eaten more home directories than rm -rf ever did.
THE SAFETY NET
Paths in, paste-ready command out. The command ships with -n: read what would happen, then flip the arm switch.
With --delete involved, the generator refuses to emit a bare delete — the net attaches itself.
Arming a delete safely: don't remove the safety — add a net. With --backup --backup-dir, rsync moves removed or overwritten files into the dated folder first.
The mirror still ends up exact. Reversibility is the difference between a mirror and a memory.
# the record's worked example — armed, net attached:
rsync -a --delete \
--backup --backup-dir=/mnt/backup/_rsync_backup_$(date +%F) \
/mnt/usb/ /mnt/backup/
verify: man rsync → --backup reads "make a backup of every file installed" · the --backup-dir rows land in DEST/_rsync_backup_<date>/, not the void
WHAT THE GENERATOR WIRES
The set that covers nearly every real transfer, grouped the way you actually decide about them:
- Paths — local or remote on either side (
user@host:/path), with the SSH port wired through-e "ssh -p 2222"when it isn't 22. - Direction — the trailing-slash toggle, with the contents-vs-directory sentence printed live.
- Filters —
--excludepatterns with presets for the usual suspects:.git,node_modules, caches, logs. - Manners —
-zcompression,--bwlimitso the 3am backup stops saturating the household,-Pfor progress and resumability,-cwhen mtime lies. - The arm lane — dry-run default, explicit arm step, net auto-attached to any
--delete.
Like the GGUF VRAM calculator: a single HTML file doing arithmetic in your browser — nothing you type leaves the page, because a tool about safe copies shouldn't phone home.
MIT, one file, no build step, at github.com/mrsaynothing/rsync-builder. If the arm flow feels like nagging, that's the feature working.
WHERE THIS SITS IN THE TOOLBOX
The generator composes the command; the siblings hold the theory. Rsync vs scp — why delta transfer beats a dumb copy, and when scp is fine.
Cron vs systemd timers is the scheduling half; the journal side of knowing whether it ran is in the journalctl cheat sheet.
A dry-run you skip is a delete you didn't mean.
end of the safety net · nothing fetched · everything local