How to --exclude /usr/ but --include /usr/local/ ?
John Van Essen
vanes002 at umn.edu
Tue Jun 7 05:13:27 GMT 2005
On Mon, 6 Jun 2005, Wayne Davison <wayned at samba.org> wrote:
> On Sun, Jun 05, 2005 at 11:28:08PM -0500, Larry Alkoff wrote:
>> In looking at man rsync, it does not appear to both
>> --exclude /usr/ and --include /usr/local/
>
> Correct, you can't exclude /usr and still get to /usr/local. What you
> want to do is to include /usr/local/ and exclude /usr/local/* (in that
> order) without specifying a rule for /usr (unless you need to override
> a more general exclude).
If you want to include the contents of /usr/local, but exclude other
subdirectories of /usr, it should be excluding /usr/*, not /usr/local/*.
>> I start rsync at / and the files I wish to save are in /usr/local
>> plus /home and some other directories.
>
> I'd suggest putting +/- rules into a file and using --exclude-from. For
> instance:
>
> + /home/
> + /usr/
> + /usr/local/
> - /usr/local/*
Should be - /usr/*
> + /some/
> + /other/
> + /other/directories/
> - /other/*
That example is correct.
John
More information about the rsync
mailing list