Copying / syncing files over a local network with rsync

An article, posted more than 3 years ago filed in how i do it, rsync, copy, files, unix & macos.

Just a short article to document for myself how to copy a large directory (e.g. a user-folder) over a local network. While (s)cp might work for smaller operations, rsync is my preferred tool as you can restart it when it breaks + in case you found an optimization, you can just abort and restart. Some things to take into account before I share the command:

So here is the command:

rsync -aWP --inplace --exclude-from=exclude-file.txt murb@someaddress:/Users/username/ .

Breakdown:

My exclude file looked like this:

*/node_modules/*
*/.rbenv*/*
.rbenv/*
Library/Caches/*
Library/Developer/*
Library/Containers/*
Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw\
*/.git/objects/*

Note that some of the excluded files might be useful if you’re offline for a longer period of time on your new machine, but typically you can rebuild the contents directly from the sources.

Op de hoogte blijven?

Maandelijks maak ik een selectie artikelen en zorg ik voor wat extra context bij de meer technische stukken. Schrijf je hieronder in:

Mailfrequentie = 1x per maand. Je privacy wordt serieus genomen: de mailinglijst bestaat alleen op onze servers.