Using Rsync With Your Web Host

Linux Logo This was one of those “Holy crap this is so frickin’ awesome who needs Viagra this here makes my…” moments for me. If this seems pedestrian to you, keep in mind I haven’t used third-party hosting since around the Y2K debacle, when FTP was the gold standard. Nowadays a lot of web hosts provide SSH access.

FTP is still nice, but rsync presents a much more elegant solution. Unfortunately, rsync is something most Windows users don’t know about. Microsoft includes no equivalent, so you can either attempt to get rsync and cygwin working on your system, or grab a copy of DeltaCopy…which is made by a company that makes a competing product.

But if you’re running Linux you can forget all that nonsense and get to the good stuff.

Copying from the host to your local computer:

rsync -avz -e “ssh -p nnnn” [user]@[domain]:[remote dir] [local dir]

You can then edit files locally using your editor(s) of choice. Heck, you can even run your own web server to test changes if you want. You can even run that web server in a VM if you don’t want the potential pitfalls of having a web server running on you computer.

Copying from your computer to the host:

rsync -avz -e “ssh -p nnnn” [local dir] [user]@[domain]:[remote dir]

The only thing to watch out for is that this is so easy that you become lazy. Syncing an entire directory for changes to just one file will consume way more bandwidth than just specifying that one file. For exampe: after making some small tweaks to a test HTML file I noted I was transferring 89K of data for the sake of updating a 2K file.

Advertisements