Title: Exclude a directory with rsync
Author: Sandro Tosi
Last modified: 2005-07-13
I use rsyncU to backup my data, and I want to exclude some
directories, as temp dirs or the firefox cache.
To do this, UI find the switch ``--exclude=...'' in the manpage. I
create a test case this way:
I've created a directory ``r'' with the following structure:
r
r/a
r/a/1
r/a/2
r/a/2/file
r/a/3
r/a/3/1
r/a/3/2
r/a/3/3
r/b
which I'd like to synchronize with ``s'' dir excluding the ``r/a''
subdirectory, so:
$ rsync -an --progress --exclude=r/a r/ s/
but this returns:
10 files to consider
./
a/
a/1/
a/2/
a/2/file
a/3/
a/3/1/
a/3/2/
a/3/3/
b/
sent 254 bytes received 80 bytes 668.00 bytes/sec
total size is 0 speedup is 0.00
Hey, the files are all there! Here the solution: --exclude is relative
to the source directory! Look at this:
$ rsync -an --progress --exclude=a r/ s/
building file list ...
2 files to consider
./
b/
sent 95 bytes received 32 bytes 254.00 bytes/sec
total size is 0 speedup is 0.00
Yes, you get it... |