First of all, I really read a lot about this topic (including Rsync filter: copying one pattern only), but I still don't understand, or I have a problem with my installation...
My structure "from" is something like this:
Windows Users User1 Documents doc1.txt doc2.txt AppData Downloads User2 Documents doc3.txt doc4.txt AppData Downloads
I want to backup all Documents folders and subfolders from all users, but not AppData and Downloads structures.
On the destination I want:
Users User1 Documents doc1.txt doc2.txt User2 Documents doc3.txt doc4.txt
I did tried many patterns, but none are working well. Let's start with this one:
rsync -av --include="*/" --exclude="*/AppData" --exclude="*/Downloads" /source/Users /destination
What should I do to exclude AppData and Downloads folders and subfolders for each user ?
There is another thread discussing almost the same thing (if I well understand it): rsync with absolute paths and excluding subpaths
I adapted the answer to my situation, but the AppData and Downloads are still present on the destination path.
rsync -av --no-p --include="*/" --include="*/Documents/**" --exclude="** /source/Users /destination