Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

22 October 2026 · One command a day

How do I copy a folder to another server with rsync?

rsync copies files and folders from one machine to another over SSH. It only sends what has changed. You use it when you need to move a site, a backup or a folder of uploads to another server quickly, with permissions and timestamps kept.

I learn my automation tips in the AI Profit Boardroom. Have a look here. Affiliate link.

The command

rsync -avz --progress source/ user@host:/dest/

-a is archive mode. It copies folders recursively and keeps permissions, timestamps and symlinks. It only keeps owner and group when the receiving side runs as root, so you may need to fix file ownership afterwards. -v lists each file as it goes. -z compresses data in transit. This helps on slow links and with text files such as HTML, CSS and logs. --progress shows a progress line for every file. source/ is the local folder, and the trailing slash means copy what is inside it. user@host:/dest/ is the SSH login and the path on the remote server. rsync must be installed on both machines. If it is missing, run sudo apt install rsync.

What you will see

sending incremental file list
./
index.html
          4,312 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=5/7)
css/
css/style.css
         18,904 100%   18.03MB/s    0:00:00 (xfr#2, to-chk=3/7)
images/
images/logo.png
         52,120 100%   24.85MB/s    0:00:00 (xfr#3, to-chk=0/7)

sent 61,402 bytes  received 103 bytes  41,003.33 bytes/sec
total size is 75,336  speedup is 1.22

Under each file name is a line showing bytes copied, percentage, speed and time taken. xfr# counts the files transferred so far. to-chk shows how many entries are still to check, out of the total. The summary shows how many bytes went each way. A speedup above 1 means rsync sent less than the full size, because of compression or skipped files. If you run the same command again, almost nothing is sent, because nothing has changed.

When to use it

Watch out for

The trailing slash on the source changes the result. source/ copies what is inside the folder straight into /dest/. source without the slash copies the folder itself, so you end up with /dest/source/. A slash on the destination makes no difference. If your files land one level too deep, this is almost always the reason. To check before anything is copied, add --dry-run and read the file list.

Questions people ask

Does rsync delete files on the destination?

No. By default it only adds and updates files. Adding --delete removes destination files that are not in the source, so always test that with --dry-run first.

How do I use rsync with a different SSH port?

Pass the port to SSH with -e, for example rsync -avz --progress -e 'ssh -p 2222' source/ user@host:/dest/.

Copying folders directly between servers over SSH, with full control of paths and permissions, is the kind of thing you can only do on a server you control. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Want more automation tips? The AI Profit Boardroom on Skool is where I get mine. Have a look here. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

Related server notes: How do I copy a file to or from a server with scp? · How do I copy my SSH key to a server so I can log in without a password? · How do I read a service's logs for the last hour on Linux? · All daily notes