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 ?
Thanks
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
**
instead of*
. – muru Feb 16 '15 at 16:58exclude="**/AppData"
gave me the same result. (by the way, I'm using rsync 3.1.1). I'm also quite confused this the usage of*
. I even saw in some command linestest/***
... – huotg01 Feb 16 '15 at 17:10rsync -avr --exclude="AppData" --exclude="Downloads" /source/Users /destination
– Costas Feb 16 '15 at 18:12Documents
directly byrsync -av /source/Users/User*/Downloads /destination
– Costas Feb 16 '15 at 21:05