I try to use rsync with --include-from
and --exclude-from
options.
I have a directory structure like:
/docs/domain-[a-z]/templates
Now I want to sync templates
only if something is in there.
Further do not want to sync anything like
/docs/domain-a
and
/docs/domain-b
if templates
is empty.
I thought it would work if I exclude /docs/domain*
and include **/templates
but this is not working.
Should this work at all? Or is this just a problem of my rsync version 3.0.4 on SLES 11SP3
To clarify it
Source Dir
/docs/
/docs/anydomain/templates
/docs/anydomain/other
/docs/domain_blah/
/docs/domain_blah/tmp/
/docs/domain_blub/
/docs/domain_blub/tmp/
/docs/domain_blub/templates/anyfiles
/docs/domain_blob
/docs/ohter
/other
So I just want to sync the /domain_blub/templates
if there is something inside templates
and leave all the /docs/domain_blub/tmp
and other files away
But I too want to sync contents from /docs/anydomain/
or /docs/other
and even /other
The target structure looks the same but there might be more domains set up which shouldn't be deleted or changed. It could look like this
/docs/
/docs/anydomain/templates
/docs/anydomain/other
/docs/domain_balah/
/docs/domain_balah/tmp/
/docs/domain_aaaa/
/docs/domain_aaaa/tmp/
/docs/domain_blah/
/docs/domain_blah/tmp/
/docs/domain_blub/
/docs/domain_blub/tmp/
/docs/domain_blub/templates/anyfiles
/docs/domain_blob
/docs/ohter
/other