rsync with --exclude files

Leaw, Chern Jian
Thu, 25 Jul 2002 03:08:02 -0000

HI,

I'm trying to exclude some files & directories from a filesystem which I
would like to copy to a different site. I did:

# rsync -avz --exclude-file=/fs21/tmp/perl_scripts/exclude.txt
/fs22/a/circuit_design   mickey.willow.com:/cpu/store/design

where file /fs21/tmp/perl_scripts/exclude.txt  contains the following
directories and files to be excluded from  /fs22/a/circuit_design    :
# cat /fs21/tmp/perl_scripts/exclude.txt
/fs22/a/circuit_design/file1
fs22/a/circuit_design/file2
fs22/a/circuit_design/dir1

I'm invoking rsync from a machine named winnie.willow.com to transfer
files/directories in /fs22/a/circuit_design to
mickey.willow.com:/cpu/store/design.
However, it still copies all files or directories in the filesystem
/fs22/a/circuit_design  to  mickey.willow.com:/cpu/store/design. It should
not include the files/directories mentioned in the
/fs21/tmp/perl_scripts/exclude.txt file.

I've tried with   the following for excluding just 1 file or directory and
it works:
# rsync -avz --exclude=/fs22/a/circuit_design/file1   /fs22/a/circuit_design
mickey.willow.com:/cpu/store/design

It does not however work when I did the following for excluding >1
file/directory:
rsync -avz --exclude=/fs22/a/circuit_design/file1
--exclude=/fs22/a/circuit_design/file2   /fs22/a/circuit_design
mickey.willow.com:/cpu/store/design

I was wondering if this should be the way to rsync a filesystem, excluding
some files/ directories?

Please help.

Thanks.