[CentOS] excluding directories in rsync

Ski Dawg centos at skidawg.org
Wed Oct 3 03:23:45 UTC 2007

Hello Everyone,

I am trying to exclude a directory (and all file and sub-directories
under that directory) when using rsync.

I have spent two days on google, but everything that I can find there
involves excluding individual files, not an entire directory.

I have tried the following commands, but in each case the remove_dir and
all of its sub-directories and files area still sent to the remote

1) rsync --delete --compress --archive --rsh=ssh 
--exclude="**/remove_dir/**" /local/path/ $user@$host:remote/path

2) rsync --delete --compress --archive --rsh=ssh 
--exclude="\*\*/remove_dir/\*\*" /local/path/ $user@$host:remote/path

3) rsync --delete --compress --archive --rsh=ssh 
--exclude="/local/path/**/remove_dir/**" /local/path/ 

4) rsync --delete --compress --archive --rsh=ssh 
--exclude-from=/path/to/exclude_file /local/path/ $user@

and the /path/to/exclude_file contains:
# don't include these files/dirs
- **/remove_dir/**

Any thoughts on the proper way to exclude an entire directory and its 
sub-directories and files when doing an rsync?

Registered Linux User #285548 (http://counter.li.org)
Random Thought:
	If it's too loud, you're too old.

More information about the CentOS mailing list