rsync --include multiple directories only syncing top level

I'm trying to rsync three directories and all their contents from a remote server to a local folder, using the following command:

rsync -havzP --delete --include 'content/***' --include 'data/***' --include 'public/assets/***' --exclude '*'  user@host:path/ ./

The intention being that the tree structure would be maintained, so I'd end up with this locally:

* content
  * [files]
* data
  * [files]
* public
  * assets
    * [files]

It mostly works perfectly, except it only syncs content and data, public/assets is not downloading for some reason.

What have I done wrong?


Solution 1:

I figured it out thanks to this answer: https://stackoverflow.com/a/46227148/39428

public/assets/*** wasn't being included because the exclude rule was excluding public. So that has to be included as well:

rsync -havzP --delete --include 'content/***' --include 'data/***' --include='public' --include 'public/assets/***' --exclude '*'  user@host:path/ ./