Can we add per device global ignore patterns (with defaults for macOS and Windows)

Hi!

I’m a very happy new user of Syncthing, surprised how easy to use a piece of Open Source software can be! Everything was straightforward and easy to set up, except for one thing:

For some reason, Syncthing syncs .DS_Store files to my windows machine by default. Why does it do that?

So I searched Github issues, and people have been complaining about this for years, yet somehow nothing is being done about it.

The first issue about the topic was pretty clear, but it devolved into a bike shedding discussion whether to ignore .git folder by default or not: Github issue #837

Apparently it was decided that the ignore system needs to be overhauled: Github issue #2491 While a more powerful ignore system absolutely sounds like a powerful idea, it doesn’t really fix the very simple issue that Syncthing just shouldn’t sync .DS_Store and Thumbs.db

Then I found a thread here on the forum, which suggests enabling default ignore lists with #include patterns (Some thoughts on ignores syncing, includes, and defaults.) and there’s even a pull request open on Github that allows specifying default ignores for new folders (lib, gui: Default ignores for new folders (fixes #7428) by imsodin · Pull Request #7530 · syncthing/syncthing · GitHub).

Why doesn’t Syncthing just ignore .DS_Store and Thumbs.db per default? For every folder?

This is an issue that every Mac and Windows user is going to run into, and every user needs to figure out how the ignore system works, even if they just want to sync the complete folder, just because Syncthing syncs some hidden system files that it really shouldn’t sync.

So my wish would be to have a global setting in Syncthing, configurable in the UI, where you can add some ignore patterns that apply to every folder, and by default it contains these lines:

(?d).DS_Store
(?d).Spotlight-V100
(?d).Trashes
(?d)desktop.ini
(?d)Thumbs.db

If people really want to sync .DS_Store files they can do so by either changing the global ignore setting in the web interface, or by overriding patterns with the ! prefix in .stignore files.

1 Like

Default patterns are in the works (see https://github.com/syncthing/syncthing/pull/7530). Global patterns (i.e. editable patterns applied to all folders) would be cool, but someone needs to do all the work to implement them.

As for per-OS ignore patterns, there is likely going to be some controversy with them. For example, there are way more things to ignore in Windows than just the two you’ve mentioned above (e.g. the Recycle Bin, Windows backup folders, and many other system folders located in the drive root). If ignore patterns were always filled with them by default, it would create a lot of clutter, which many people will likely not enjoy. Of course, such settings could be configurable, but still, a lot of work will be required to implement all of this.

Because Syncthing’s job is to synchronize files, and it synchronizes everything by default. As you mentioned, there have been a lot of talks about default ignore patterns, but different people have different needs, so synchronizing everything is a very understandable default behaviour that causes no confusion.

I have a similar request (per device ignore patterns), although for a different reason:

I am syncing with multiple desktops and phones / tablets. I would like to ignore certain files for the phones and tablets due to space limitations.

I tried creating two separate “shared folders” in Syncthing that sync the same underlying folder but trying to use different ignore patterns (one with a pattern and one without). Unfortunately, changing the ignore pattern affects both Shared Folders.

thanks, phlepper

The key to achieving it is to look at things from the receiving end rather than from the point of view of the desktops pushing files to the phones / tablets.

First, simplify the setup by replacing the two separate shared folders with just one folder.

Next, let’s assume that the folder label is “Syncthing” and that you’ve got 3 devices named “desktop”, “phone”, and “tablet”.

“desktop” shares folder “Syncthing” with “phone” and “tablet”.

On “phone”, configure ignore patterns to exclude certain files like so (there are different ways to write the patterns ending in the same results, but we’ll keep it simple):

*.iso
*.mp4
*.wav

Likewise, for “tablet”, where you might be okay with keeping video files:

*.iso
*.wav

It won’t matter if “desktop” has ISO, MP4 and WAV files in its “Syncthing” folder because “phone” and “tablet” will ignore them.

The special #include pattern can be used to load patterns from a file. Those files can then be placed in a shared folder and synced to multiple devices, providing a way to centrally manage common sets of patterns.

Perfect, I didn’t realize you could adjust or add ignore patterns via the receiving end. I thought it was just on the sharer side. I did what you suggested and this works perfectly.

Thanks!