exclude a pattern but only in the top level
Brian K. White
brian at aljex.com
Wed May 15 02:13:48 MDT 2013
Consider the following directory structure
/foo/aaa/*/*
/foo/bbb/*/*
/foo/ccc/*/*
I want to sync all of /foo,
but exclude /foo/aaa
but not exclude any other occurances of "aaa" or "foo/aaa" (be they
files or dirs) that might occur within the other dirs /foo/bbb/*
/foo/ccc/* etc
I don't want to exclude /foo/bbb/aaa or /foo/ccc/111/aaa or
/foo/ccc/111/foo/aaa etc...
Destination is running rsync daemon and has a module named root that
points to "/" such that normally, for the full /foo with no exclude,
it's very simple, my rsync command would just be:
rsync -avz /foo ${DEST}::root
That works fine without the exclude.
So, to that I want to add a filter file. (Well, I assume that's what I want)
rsync -avz -f ". filter" /foo ${DEST}::root
If I construct a filter file like this:
- aaa
+ *
or like this
- aaa/
+ *
or like this
- foo/aaa/
+ *
rsync hides the top level /foo/aaa but it also hides any other
occurrences of the exclude pattern that occur anywhere within the job
instead of just the top level one.
How can I get it to exclude just the top-level directory "/foo/aaa" ?
--
bkw
More information about the rsync
mailing list