How to sync files in local network?
·Oct 31, 2022·
1 min read
Recently, I needed to send some files to my old laptop, and I used
scp to do that. I also wrote a short post about it.
However, it turned out that I also needed to send 70 GB of photos and videos, and while I was sending it via
scp, the connection broke, and I was left with around 50% of files not sent. Obviously, I didn't want to manually check which photos have been sent, and which not. There has to be a better way to do that, I thought. And there is!
Solution - rsync
Rsync is a file copying tool, but what's really cool about it is that, like the name suggests, it allows you to sync files. It checks the difference between the source and the files at the destination, and sends only the missing ones.
rsync -avzP Users/maciek/photos email@example.com:/home/maciek
a- archive, it combines recursion (
-r) and preserves other stuff, e.g. modification times
v- verbose, more info about the files being transferred, because by default rsync works silently
z- compress the data being sent
--partial, which allows to resume interrupted transfers, and
--progress, which shows progress during transfer