Trouble with include/exclude patterns

2003-02-05 Thread Anand Buddhdev
I'm using rsync 2.5.4 on my RedHat 7.3 client laptop and rsync 2.5.5
on my RedHat 8.0 server. On the client, I have a directory "rpm" with
5 subdirectories, out of which I only want to copy the one called SRPMS
across. I also have another directory ".mozilla" out of which I want to
copy across 2 files. I have constructed the following rsync invocation:

rsync -e ssh -av --delete \
--exclude='/rpm/BUILD' --exclude='/rpm/SOURCES' --exclude='/rpm/SPECS' 
--exclude='/rpm/RPMS' \
--include='.mozilla/arb/kfgj0v2y.slt/bookmarks.html' \
--include='.mozilla/arb/kfgj0v2y.slt/prefs.js' \
--exclude='.mozilla' \
.mozilla \
rpm \
$SERVER:laptop-backup

Now, this works correct for the "rpm" directory, by only copying
rpm/SRPMS, and leaving out rpm/BUILD, rpm/SOURCES, /rpm/SPECS and
rpm/RPMS.

However, it does not copy my bookmarks.html and prefs.js files. If I
add one more -v to the rsync command, I see this:

excluding directory .mozilla because of pattern .mozilla

So it seems the entire .mozilla directory is skipped, despite my 2
--include statements.

I have read the man page over and over, and I can't see what's wrong.

Any idea what I'm doing wrong? And any ideas on reducing those 4
--excludes to one --exclude and one --include for the rpm directory?

Thanks,

-- 
Anand Buddhdev
http://anand.org
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: Trouble with include/exclude patterns

2003-02-05 Thread Max Bowsher
Anand Buddhdev wrote:
> I'm using rsync 2.5.4 on my RedHat 7.3 client laptop and rsync 2.5.5
> on my RedHat 8.0 server. On the client, I have a directory "rpm" with
> 5 subdirectories, out of which I only want to copy the one called
> SRPMS 
> across. I also have another directory ".mozilla" out of which I want
> to 
> copy across 2 files. I have constructed the following rsync
> invocation: 
> 
> rsync -e ssh -av --delete \
> --exclude='/rpm/BUILD' --exclude='/rpm/SOURCES'
> --exclude='/rpm/SPECS' --exclude='/rpm/RPMS' \ 
> --include='.mozilla/arb/kfgj0v2y.slt/bookmarks.html' \
> --include='.mozilla/arb/kfgj0v2y.slt/prefs.js' \
> --exclude='.mozilla' \
> .mozilla \
> rpm \
> $SERVER:laptop-backup
> 
> Now, this works correct for the "rpm" directory, by only copying
> rpm/SRPMS, and leaving out rpm/BUILD, rpm/SOURCES, /rpm/SPECS and
> rpm/RPMS.
> 
> However, it does not copy my bookmarks.html and prefs.js files. If I
> add one more -v to the rsync command, I see this:
> 
> excluding directory .mozilla because of pattern .mozilla
> 
> So it seems the entire .mozilla directory is skipped, despite my 2
> --include statements.
> 
> I have read the man page over and over, and I can't see what's wrong.

--include .mozilla
--include .mozilla/arb/
--exclude .mozilla/arb/*
--include .mozilla/arb/kfgj0v2y.slt/
--include .mozilla/arb/kfgj0v2y.slt/bookmarks.html
--include .mozilla/arb/kfgj0v2y.slt/prefs.js
--exclude .mozilla/arb/kfgj0v2y.slt/*

Yes, its messy.

I don't think there is a better way.

> Any idea what I'm doing wrong? And any ideas on reducing those 4
> --excludes to one --exclude and one --include for the rpm directory?

would:

--include /rpm/SRPMS
--exclude /rpm/*

do what you want?


Max.

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: Trouble with include/exclude patterns

2003-02-05 Thread Wayne Davison
On Thu, Feb 06, 2003 at 01:17:34AM -, Max Bowsher wrote:
> --include .mozilla
> --include .mozilla/arb/
> --exclude .mozilla/arb/*
> --include .mozilla/arb/kfgj0v2y.slt/
> --include .mozilla/arb/kfgj0v2y.slt/bookmarks.html
> --include .mozilla/arb/kfgj0v2y.slt/prefs.js
> --exclude .mozilla/arb/kfgj0v2y.slt/*

Close, but not quite.  The order of a couple lines is reversed and that
might copy more than one file from the .mozilla/arb dir.

I'd also suggest putting the lines into an include file so that the
command-line only needs an --include-from=file_name directive.  The
lines would get +/- prefixes to tell it what to include/exclude:

+ /rpm/SRPMS/
+ /rpm/.mozilla/
- /rpm/*
+ /rpm/.mozilla/arb/
- /rpm/.mozilla/*
+ /rpm/.mozilla/arb/kfgj0v2y.slt/
- /rpm/.mozilla/arb/*
+ /rpm/.mozilla/arb/kfgj0v2y.slt/bookmarks.html
+ /rpm/.mozilla/arb/kfgj0v2y.slt/prefs.js
- /rpm/.mozilla/arb/kfgj0v2y.slt/*

I _think_ that will work.

..wayne..
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: Trouble with include/exclude patterns

2003-02-05 Thread Max Bowsher
Wayne Davison wrote:
> On Thu, Feb 06, 2003 at 01:17:34AM -, Max Bowsher wrote:
>> --include .mozilla
>> --include .mozilla/arb/
>> --exclude .mozilla/arb/*
>> --include .mozilla/arb/kfgj0v2y.slt/
>> --include .mozilla/arb/kfgj0v2y.slt/bookmarks.html
>> --include .mozilla/arb/kfgj0v2y.slt/prefs.js
>> --exclude .mozilla/arb/kfgj0v2y.slt/*
> 
> Close, but not quite.  The order of a couple lines is reversed and

Duh. Thanks for picking up on that.

> that might copy more than one file from the .mozilla/arb dir.

It would copy nothing from arb, surely?

> I'd also suggest putting the lines into an include file so that the
> command-line only needs an --include-from=file_name directive.  The
> lines would get +/- prefixes to tell it what to include/exclude:

I don't think .mozilla was in rpm:

+ /rpm/SRPMS/
- /rpm/*
+ /.mozilla/
+ /.mozilla/arb/
- /.mozilla/*
+ /.mozilla/arb/kfgj0v2y.slt/
- /.mozilla/arb/*
+ /.mozilla/arb/kfgj0v2y.slt/bookmarks.html
+ /.mozilla/arb/kfgj0v2y.slt/prefs.js
- /.mozilla/arb/kfgj0v2y.slt/*


Max.

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: Trouble with include/exclude patterns

2003-02-05 Thread Wayne Davison
On Thu, Feb 06, 2003 at 01:58:28AM -, Max Bowsher wrote:
> It would copy nothing from arb, surely?

Sorry, I meant to say that it might copy more from .mozzilla than just
arb, but a re-edit ruined that thought.

> I don't think .mozilla was in rpm:

You're right, I missed that.  Duh.  Hopefully third time's a charm.

..wayne..
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: Trouble with include/exclude patterns

2003-02-06 Thread Anand Buddhdev
On Thu, Feb 06, 2003 at 01:58:28AM -, Max Bowsher wrote:

> >> --include .mozilla
> >> --include .mozilla/arb/
> >> --exclude .mozilla/arb/*
> >> --include .mozilla/arb/kfgj0v2y.slt/
> >> --include .mozilla/arb/kfgj0v2y.slt/bookmarks.html
> >> --include .mozilla/arb/kfgj0v2y.slt/prefs.js
> >> --exclude .mozilla/arb/kfgj0v2y.slt/*
> > 
> > Close, but not quite.  The order of a couple lines is reversed and
> 
> Duh. Thanks for picking up on that.
> 
> > that might copy more than one file from the .mozilla/arb dir.
> 
> It would copy nothing from arb, surely?
> 
> > I'd also suggest putting the lines into an include file so that the
> > command-line only needs an --include-from=file_name directive.  The
> > lines would get +/- prefixes to tell it what to include/exclude:
> 
> I don't think .mozilla was in rpm:
> 
> + /rpm/SRPMS/
> - /rpm/*
> + /.mozilla/
> + /.mozilla/arb/
> - /.mozilla/*
> + /.mozilla/arb/kfgj0v2y.slt/
> - /.mozilla/arb/*
> + /.mozilla/arb/kfgj0v2y.slt/bookmarks.html
> + /.mozilla/arb/kfgj0v2y.slt/prefs.js
> - /.mozilla/arb/kfgj0v2y.slt/*

This works just as I wanted it to :)  Now I also understand the
exclude/include logic better. Thanks guys!

-- 
Anand Buddhdev
http://anand.org
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html