I recently needed to move several gigabytes of data from an old laptop running Windows 8.1 to another laptop running macOS and my options were to use an external disk or a network transfer. I wanted the whole process to be unattended so I naturally gravitated towards doing the transfer over my WiFi network.
For the network transfer, the easiest method I could think of was to use
scp but it turns out that there's no built-in support to "move" files with
scp. My options were to write a script to delete each file after getting copied or use a different tool with file move semantics.
A couple of Google searches later, the most up-voted tool on Serverfault for the task is
rsync. I'ved used
rsync before but I have never used it on a Windows box so this was an interesting option to try out.
Some additional searches led me to this answer how to use rsync from Windows PC to remote Linux server? that I was hoping would be a drop-in solution to my situation.
Unfortunately, I couldn't get
rsync working on my first try because the instructions in the most-upvoted answer along with other answers on the question no longer work in 2021. Even this somewhat useful article on installing rsync on Windows from more than a year ago, which I found on Google, was almost completely out of date.
I had to figure out a few missing steps to get
rsync working on Windows, so I decided to publish step-by-step instructions to help my future self and others in a similar situation. I tested the commands below on Windows 8.1, nonetheless they should work on Windows 10 or 11.
The macOS side of things are fairly straight forward so I wont go into that here.
- Install Git for Windows to the path "C:\Program Files\Git".
In my case I already had it installed so installation merely updated my version to v22.214.171.124.
2. Visit https://repo.msys2.org/msys/x86_64/ and download the following three (3) file archives:
- rsync-3.2.3-1-x86_64.pkg.tar.zst - the
rsyncbinary for Windows;
- libxxhash-0.8.0-1-x86_64.pkg.tar.zst - a (cryptographic) dll that
- libzstd-1.5.0-1-x86_64.pkg.tar.zst - a (compression) dll that
.zst extension indicates that the files were compressed using the fast Zstandard compression algorithm open sourced by Facebook so I had to download another (open source) tool to help me extract those files locally: PeaZip for Windows v8.2.0.
4. Create a temporary folder called "C:\tmp" then use PeaZip to extract the 3 files we downloaded earlier into this folder, in two (2) steps.
The 1st step is to use PeaZip to convert
.tar.zst files to
The 2nd step is to use PeaZip to extract the contents of each
.tar file. Note that all 3 archives contain a folder named
\usr with different contents, so be sure to click "yes" when prompted to overwrite the contents of the
C:\tmp\usr folder during the extraction process.
5. Now, you need to move the
C:\tmp\usr folder to its final destination i.e.
C:\Program Files\Git, or the location where you have Git for Windows installed.
Essentially, we need to merge the contents of
C:\Program Files\Git\usr so that the
rsync binary (and its dependencies) will end up at the following path
6. The final step is to confirm that you have a working installation of
rsync from a command prompt by executing these 2 commands:
cd "C:\Program Files\Git\usr\bin" and
rsync.exe --version rsync version 3.2.3 protocol version 31 Copyright (C) 1996-2020 by Andrew Tridgell, Wayne Davison, and others. Web site: https://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints, socketpairs, hardlinks, no hardlink-specials, symlinks, IPv6, atimes, batchfiles, inplace, append, ACLs, xattrs, optional protect-args, iconv, symtimes, prealloc, stop-at, no crtimes Optimizations: no SIMD, asm, openssl-crypto Checksum list: xxh128 xxh3 xxh64 (xxhash) md5 md4 none Compress list: zstd lz4 zlibx zlib none rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence for details.
7. You are done. Enjoy!