⚠ Created by ChatGPT 🤖
It does not move the parent folder by default — this trips a lot of people up.
rsync copies the contents of the source directory, and whether the parent folder itself appears at the destination depends on the trailing slash.
The key rule (trailing slash matters a lot)
1️⃣ With a trailing slash → copies contents only
rsync -av source_dir/ dest_dir/
Result:
dest_dir/
├── file1
├── file2
└── subdir/
source_dir itself is not created inside dest_dir.
2️⃣ Without a trailing slash → copies the folder itself
rsync -av source_dir dest_dir/
Result:
dest_dir/
└── source_dir/
├── file1
├── file2
└── subdir/
Here, the parent folder is included.
3️⃣ 🧠 What Happens With .
. already means:
“the contents of the current directory”
There is no parent folder name to recreate.
So both of these:
rsync -av . /backup/
rsync -av ./ /backup/
Will copy: all files and folders inside current directory
🧩 Quick Summary
| Source | Result |
|---|---|
folder | creates dest/folder/ |
folder/ | copies contents only |
. | copies contents |
./ | copies contents (same as .) |
TL;DR
- Trailing slash = no parent folder
- No trailing slash = parent folder included
rsynccopies by default, doesn’t move unless you force it
If you want, tell me what you’re trying to end up with and I’ll give you the exact command 👌