What it does
Builds one rsync command from the options you pick and explains each option in it. For the most common mistake — the trailing slash on the source — it shows where a.txt ends up with your paths, and when you pick --delete it puts the --dry-run version right above the result. Remote paths with spaces or ~, which rsync versions read differently, produce no command.
Examples
| Command | Result |
|---|---|
rsync -a site/ /backup/ | site/a.txt → /backup/a.txt — the contents |
rsync -a site /backup/ | site/a.txt → /backup/site/a.txt — the folder itself |
rsync -a --delete site/ /backup/ | files only in /backup/ are deleted |
--exclude='*.log' | names ending in .log at any depth are skipped |
--exclude='/cache/' | only the cache directory at the top of the transfer (docs/cache/ is still copied) |
-e 'ssh -p 2222' | connect with ssh on port 2222 |
Common mistakes
- One slash, one extra folder level —
rsync -a site /var/www/site/creates/var/www/site/site/. Add/to the end of the source to sync the contents. A trailing/on the destination makes no difference for directories. - Running
--deletestraight away — swap source and destination or drop a slash and good files on the destination are deleted. Add--dry-runto the same command and read the "deleting" lines first. - What a leading
/in an exclude means — it is the top of the transfer, not the root of the disk. Without a trailing slash on the source the top is one level higher, so you need/site/cache/.
How it was checked
Before publishing, 34 generated commands were run with rsync 3.2.7 between local folders on this server, and the resulting file list on the receiving side was compared with the explanation on screen (trailing slash, exclude patterns, --delete, --dry-run), including the permission difference between -a and -rlt — 65 checks in total. Remote commands were compared as text only, without connecting.
FAQ
Do I need a trailing slash on the destination too?
Not if the destination is a directory — both forms behave the same. The slash that matters is on the source. One exception: when the source is a single file and the destination directory does not exist yet, the trailing slash on the destination makes rsync create that directory and put the file inside.
Can I get back files removed by --delete?
rsync has no trash. To keep them, add --backup --backup-dir=/path so deleted and overwritten files are moved there. Above all, read the --dry-run output first.
Is what I type sent to a server?
No. The command is built in your browser. Paths and host names are not sent to a server and are not passed to the analytics or ads this site uses. See the privacy notice.