I recently purchased a new computer and needed to transfer files from the old computer to the new one. Tried a USB drive, no luck. Tried copying files over the network via the macOS Finder, but the sheer number of files (~500,000) made this an exercise in futility.
Googling for a better solution led me to
rsync, a highly efficient file transfer and synchronization tool.
rsync is open source and comes pre-installed on macOS. After talking with friends, this is the utility they use. Probably should have asked them before trying to figure it out myself.
rsync has a simple API:
rsync [OPTIONS] SOURCE DESTINATION
There are a ton of options and I wasn't too sure what to select. I wanted to preserve symbolic links and last modified datetimes. After looking thru the
man pages and StackOverflow, I settled on the following:
-v verbose -h human-readable -a archive mode -H preserve hard links -E copy extended attributes, resource forks --progress show progress during transfer
Next I needed to find a way to specific a remote machine in the terminal. The syntax for this is
Putting it together with some error logging gives us the following:
$ rsync -vhaHE --progress alysivji@MacSivProOG.local:/Users/alysivji/Documents/siv-dev /Users/alysivji/shared/siv-dev 2> errors.log ... sent 12.02M bytes received 21.36G bytes 6.96M bytes/sec total size is 21.29G speedup is 1.00
That was easy. What a great utility! More rsync goodness.
I did a short retro after figuring out how to transfer files from one machine to the next:
What went well
- Was able to transfer files from old computer to new computer
What did not go well
- trying to transfer files using USB and WiFi
What to improve going forward
- ask friends for tips and tricks before getting started
- always look for a UNIX first solution. Somebody has already solved my problem, I just don't know it