Trouble with include/exclude patterns

Anand Buddhdev arb at
Thu Feb 6 12:10:14 EST 2003

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 \

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

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?


Anand Buddhdev

More information about the rsync mailing list