I went through couple of posts here and I still have doubts.
I will be syncing from Mac folder /Users/user(this is the single common root folder of all the folders I want to sync) – but I want to include ONLY the listed folders and ONLY THESE; nothing else.
Also, does the order matter? Do I need to keep certain include/exclude patters above/below one another in certain order for them to work or for them to be optimised?
Essentially what will be the simplest/cleanest way to achieve this?
Syncthing ignore patterns are folder-relative not absolute, and first match wins. I suggest starting with small and simple and using trial and error, instead of building a castle on paper up front.
This is not castle on paper! This is my trial and error. I tried many ways but I am not able to figure it out. I have this specific use case so instead of trying to type some other example and then again getting confused I presented the entire folder hierarchy as it is.
I went through the doc as well but it was not helpful (yes, I have seen couple of posts where commenders have have just replied “it’s in the doc”).
So I posted here hoping someone might have gone through a similar use case and can help me.
Sorry, I presumed this was “on paper” since none of the patterns would work as written. As said, think “first match wins” and “folder relative paths”. If your folder root is /Users/user and you want to sync only /Users/user/Movies, start with
Well, just that worked like a charm! I think I was unnecessarily thinking more complex rules.
Exclude only root folder (no other sub-root-folder ignore rules required)
And then invert the exclusion for each folders/files you want to be included.
I will share my test/dummy example (in case others have this use case):
I created this test file/folder hierarchy inside my root folder (i.e. the added folder for sync).
And then I only wanted to backup these out of the heirarchy above.
Library/Application Support/AddressBook/Sources
Library/Messages/Archive
Library/Mail
Dropbox/db_d_2
Dropbox/db big d_3
Dropbox/db_d_1
Data/data_dir_1
Data/data_dir_1
Pictures
Movies
.dotfiles
.ssh
a
All I had to do was add this in Ignore Patterns:
!Library/Application Support/AddressBook/Sources
!Library/Messages/Archive
!Library/Mail
!Dropbox/db_d_2
!Dropbox/db big d_3
!Dropbox/db_d_1
!Data/data_dir_1
!Data/data_dir_1
!Pictures
!Movies
!.dotfiles
!.ssh
!a
# then just like done above ^ we invert ignoring/exclusion of everything we want to sync/include listing each path
# ignores everything in root folder
*
That’s it - ignore everything and then invert (with !) path of what you do not want to ignore.
I could verify and I could get exactly what I wanted on my iPhone (except hidden files/folders as I could not see them on iPhone)