How to exclude directories from source with --relative
Stuart Anderson
anderson at ligo.caltech.edu
Tue May 27 04:46:04 GMT 2008
I have been unable to figure out how to exclude directories that only
exist on the source side when running rsync version 3.0.2 with --relative.
Here is an artificial test that shows my problem in case 3).
Any help would be appreciated.
# mkdir -p /tmp/source/a/b /tmp/source/a/c
# touch /tmp/source/a/b/hello /tmp/source/a/c/world
1) Try mirroring both b/ and c/, this works:
# rsync -avn --relative /tmp/source/./a/? /tmp/destination
sending incremental file list
created directory /tmp/destination
a/
a/b/
a/b/hello
a/c/
a/c/world
sent 119 bytes received 30 bytes 298.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
2) Try excluding b/, this works:
# rsync -avn --relative --exclude b/ /tmp/source/./a/? /tmp/destination
sending incremental file list
created directory /tmp/destination
a/
a/c/
a/c/world
sent 76 bytes received 23 bytes 198.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
3) Try excluding a/, this does not work:
# rsync -avn --relative --exclude a/ /tmp/source/./a/? /tmp/destination
sending incremental file list
created directory /tmp/destination
a/
a/b/
a/b/hello
a/c/
a/c/world
sent 119 bytes received 30 bytes 298.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
--
Stuart Anderson anderson at ligo.caltech.edu
http://www.ligo.caltech.edu/~anderson
More information about the rsync
mailing list