Ignore patterns in the form of "include only these" and "exclude" everything else inside a given root folder

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.

My intended sync/include set:


!/Users/user/Dropbox/Doc Backup
!/Users/user/Dropbox/Office Docs
!/Users/user/Library/Mobile Documents/com~apple~CloudDocs
!/Users/user/Library/Application Support/AddressBook/Sources
!/Users/user/iCloud Drive (Archive)

Do I need to do anything else? Maybe something like this? Or what I have done above it sufficient?




/Users/user/Library/Mobile Documents/*
!/Users/user/Library/Mobile Documents


/Users/user/Library/Application Support/AddressBook/*
!/Users/user/Library/Application Support/AddressBook

/Users/user/Library/Application Support/*
!/Users/user/Library/Application Support



Now do I even need to do this as well? Since my root/sync folder will be “/Users/user” I think it won’t even scan anything outside it, right?



I also want to ignore these no matter where they are - so I have kept there at top - these might be inside my include folders as well


/Users/user/Pictures/Photos Library.photoslibrary

Do I need all A, B, C, D?

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


(“Don’t ignore Movies; Ignore everything else”)

Build from there, adding patterns as required.

1 Like

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



Dropbox/db big d_3



All I had to do was add this in Ignore Patterns:

!Library/Application Support/AddressBook/Sources
!Dropbox/db big d_3
# 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)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.