Skip to main content

Exclude Files and Folders From an Rsync Copy

I’ve been sticking to plain old rsync -az to sling files around using Rsync.
Until I ran into a hiccough today, where I filled up my teensy remote storage on the Pi, because a couple of subdirectories that were part of the run, were hundreds of megabytes large.1

So I did the usual, did hunt around the web thing, and learnt about --exclude

So now the new Rsync command is …

rsync -az src dest --exclude={'excluded_dir_1','excluded_dir_2'}

And my poor Pi no longer has disk full nightmares.


  1. I’d expected the normal run to be a few hundred kilobytes in size. ↩︎