rsync Command Generator — Build & Decode rsync Commands
rsync is powerful and unforgiving — one wrong flag and you've deleted the
wrong side. Pick your options and get the exact command, with every flag explained
and the dangerous ones flagged. Or paste an rsync command to decode it. Runs in your
browser.
Your command
—
Or: decode an rsync command
Paste any rsync command — every flag gets explained.
The trailing slash is the whole game
This is the rsync rule that catches everyone: a trailing slash on the source means "the contents of".
rsync -a src/ dest/→ copies what's insidesrcintodest. Files land atdest/file.rsync -a src dest/→ copies the foldersrcintodest. Files land atdest/src/file.
The destination's trailing slash doesn't matter; the source's does. When in doubt, the builder above spells out which one you're getting.
Always dry-run before --delete
--delete removes anything in the destination that isn't in the source. Combined with
a wrong path or a missing trailing slash, it can wipe a directory. Run it with -n
(dry run) first, read every line it would change, then remove -n when you're
sure. There is no undo.
Gotchas worth knowing
-aalready includes-r. Archive mode is recursive and preserves permissions, times, symlinks and ownership — it's the flag you want 90% of the time. Don't add-ron top.-zhelps over a network, not locally. Compression costs CPU; for a local disk-to-disk copy it usually slows things down. Use it for remote/SSH transfers.- rsync only resends what changed. Re-running the same command is cheap — it
compares size and time and skips unchanged files. Add
--checksumif you need exact content comparison (slower). - Remote needs SSH.
user@host:/pathtransfers over SSH automatically; you don't need-e sshunless you're changing SSH options.
Frequently asked questions
What does rsync -avz mean?
a archive (recursive + preserve everything), v verbose, z
compress during transfer. It's the everyday "mirror this folder" command, usually with a remote
destination.
How do I copy a folder to a remote server with rsync?
rsync -avz /local/folder/ user@server:/remote/path/. The trailing slash on the source
copies the contents; drop it to copy the folder itself.
How do I make rsync delete files removed from the source?
Add --delete, but run it with -n (dry run) first:
rsync -avzn --delete src/ dest/ shows what would be removed without touching anything.
What's the difference between rsync src/ and src?
The trailing slash. src/ copies the contents into the destination; src
copies the folder itself, creating dest/src/.
Archiving or searching files next? See the tar generator and find generator, or all tools on the home page.