The rsync generator that refuses a bare delete
Dry-run by default, an explicit arm step, a backup net: --backup --backup-dir=DEST/_rsync_backup_$(date +%F). The generator refuses to emit a bare --delete, and nothing you type leaves the page.
The rsync generator answers one question: what happens when --delete is in the command and the source path is wrong? It ships with -n, makes you flip an arm switch, and attaches a dated backup folder. A bare delete never leaves the page.
A dry-run you skip is a delete you didn't mean.
Why does --delete deserve a warning?
rsync's contract is make the destination match the source. The man page says --delete will "delete extraneous files from the destination dir" — and extraneous means anything the source lacks, including files missing because you mounted the wrong USB stick.
| flag | what it does | when you're wrong |
|---|---|---|
--delete | removes destination files missing from source | wrong source path → files "extraneous" → gone |
src/ vs src | slash copies contents; no slash copies the directory | one character, entirely different layout |
-a | archive: recursive, perms, times, owners, symlinks | skipped → a "backup" that silently isn't one |
--partial | keeps half-transferred files on interruption | flaky link → whole transfer restarts from zero |
character — the trailing slash — decides everything. src/ pours contents into the destination; src grows a dest/src folder and pours them in there.
How does the rsync generator make --delete safe?
Arming a delete safely means adding a net, not removing the safety. rsync moves each file it would have deleted or overwritten into the dated folder first. The mirror still ends up exact.
rsync -a --delete \--backup --backup-dir=/mnt/backup/_rsync_backup_$(date +%F) \/mnt/usb/ /mnt/backup/
The record's worked example, armed with the net attached.
- type paths — local or
user@host:/pathon either side; port goes through-e "ssh -p 2222"when it isn't 22 - read the
-ndry-run output — the contents-vs-directory sentence prints live as you type the slash - flip the arm switch — the net auto-attaches to any
--delete; a bare delete never ships
--backup --backup-dir lands removed files in DEST/_rsync_backup_<date>/, not the void. A tool about safe copies shouldn't phone home.what the generator wires
paths local or remote on either side · -e "ssh -p NNNN" for non-22 direction trailing-slash toggle, sentence printed live filters --exclude presets: .git · node_modules/ · .cache/ · *.log manners -z · --bwlimit · -P · -c when mtime lies arm lane dry-run default · explicit arm · net on every --delete
One HTML file, no build step, MIT — github.com/mrsaynothing/rsync-builder.
- recorded 2026-10-16 — rsync(1) man-page semantics, protocol 32, in-browser, nothing uploaded
- every flag row is the man page's own contract; machine runs the same two net flags
- verify: man rsync — --backup reads "make a backup of every file installed"