Hi, I'm trying to synchronize some directories. Let's say I need to synchronize: /web/sites /var/qmail/control /home/ken I don't want to run 3 rsync commands. I have already tried using --include --exclude options, but it didn't work at all. I supppose my command should be as follows: rsync -azvl --include-from=includes --exclude='*' / username@host.com:/ken/backup/ includes: /web/sites /var/qmail/control /home/ken The result is that I get nothing. Nothing is copied then. No errors reported by rsync. I also tried the same command, but without --exclude opotion.. and by chaning includes file: +/var/qmail/control +/web/sites +/home/ken -* (-/*) What am I missing ? Thank you! Regards, Ken
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/kenIf 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@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@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..
> On Mon, Mar 17, 2003 at 04:5929PM +0100, Wayne 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@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@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.It worked! Now I understand how "include-from" really works. Thank you very much for your help, Wayne. Regards, Ken