Wildcards (include)

Wayne Davison wayned at users.sourceforge.net
Tue Mar 18 02:58:55 EST 2003


On Mon, Mar 17, 2003 at 04:06:29PM +0100, Ken wrote:
> Let's say I need to synchronize:
> 
> /web/sites
> /var/qmail/control
> /home/ken

If your command is that simple, you should just list all the dirs on the
commandline without any include/exclude stuff and use -R (--relative):

rsync -azvlR /web/sites /var/qmail/control /home/ken username at host.com:/ken/backup/

Only when you overflow the commandline do you need to resort to
include/exclude syntax (or use the new --files-from option, if that
is available to you -- see the mailing list archive for more info).

To understand what you are doing wrong with the include/exclude syntax,
you would do well to read the man page on this topic.  It boils down to
specifying all needed directories that guide the hierarchical descent to
the directories you wish to send.  I also prefer to avoid a global "*"
exclude, so I'd write the "includes" file like this:

+ /var/
+ /web/
+ /home/
- /*
+ /var/qmail/
- /var/*
+ /var/qmail/control/
- /var/qmail/*
+ /web/sites/
- /web/*
+ /home/ken/
- /home/*

Which you'd use with the following command:

rsync -azvl  --include-from=includes / username at host.com:/ken/backup/

An alternative "includes" file that uses a global "*" exclude would look
like this:

+ /var/
+ /var/qmail/
+ /var/qmail/control/
+ /var/qmail/control/**
+ /web/
+ /web/sites/
+ /web/sites/**
+ /home/
+ /home/ken/
+ /home/ken/**
- *

Some folks might like that syntax better.

..wayne..


More information about the rsync mailing list