Re: excluding directories in rsync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




This may work. If worked, Pls reply to the list by appending SOLVED to the subject line. Then, Others can beniit. 


rsync -avz --delete --exclude=**/stats --exclude=**/error --exclude=**/files/pictures -e "ssh -i /root/rsync/mirror-rsync-key" someuser@xxxxxxxxxxxxxxxxxxx:/var/www/ /var/www/

(The --delete option means that files that have been deleted on server1.example.com should also be deleted on mirror.example.com. The --exclude option means that these files/directories should not be mirrored; e.g. --exclude=**/error means "do not mirror /var/www/error". You can use multiple --exclude options. I have listed these options as examples; you can adjust the command to your needs. Have a look at


another URL to read,

http://www.howtoforge.com/mirroring_with_rsync_p2

GOOD LUCK

On 10/3/07, Ski Dawg <centos@xxxxxxxxxxx> wrote:
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
server.

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/
$user@$host:remote/path

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

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?
--
Doug

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

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



--
Thank you
Indunil Jayasooriya
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux