Blog

How to Ignore Files in Syncthing

Ignore files in Syncthing with a root .stignore file. Learn rule order, folder matching, shared patterns, and fixes for exceptions that still transfer.

How to Ignore Files in Syncthing. Syncthing website preview with its file-synchronization branding.
On this page

To ignore files in Syncthing, add a UTF-8 file named .stignore to the root of the shared folder and write the names or patterns you want excluded. Start with one ordinary folder name. Expand the rules only after the basic exclusion behaves as expected on each device.

Ignore files in Syncthing before writing broad exceptions

The surprising part is that .stignore itself never synchronizes. Adding it on your desktop doesn't give your laptop the same exclusions. Each device needs its own file, even when both share the same folder. Syncthing can include a separate synchronized pattern file, but that takes a little more setup.

The official ignoring documentation, checked October 9, 2026, defines the matching rules. This guide uses those rules to build small examples. The Syncthing directory page has the project details.

My pick is a short exclusion list for a single work folder. A whole home directory contains application settings and caches with very different needs. Splitting Documents and project files into separate shares is easier to reason about than a long exception list covering your entire user account.

1. Find the shared folder's root

Open the folder on disk that you added to Syncthing. The root is the top of that specific share, even if it sits inside another directory. A rule file in a child directory won't apply to the share above it.

For an example folder named Work, put .stignore directly inside Work alongside your documents. Don't place it inside Work/Client A unless Client A is itself the shared root. This is a file placement step, so there isn't a special menu name to learn.

Write down the path on both devices. They can be different local paths while referring to the same shared folder. That small note makes it harder to edit an unused copy of the rule file later.

2. Create a plain UTF-8 file

Use a plain-text editor, save the file as .stignore, and select UTF-8 encoding. Confirm the final filename doesn't end in .txt. A document editor that adds formatting is the wrong tool for this file.

Put one unwanted folder name on its own line:

node_modules

This excludes that name wherever it occurs inside the share. It is a practical first rule for a project tree containing generated dependencies. Keep source files and package manifests separate from the dependency directory so the files needed to rebuild remain available.

Save the file before letting the other device begin its initial transfer. Use an empty example project if you want to understand the pattern without involving an existing work archive.

3. Choose names or root paths

A bare name such as cache matches that name at any depth. A leading slash narrows the match to the share root. The following example leaves subdirectories named cache alone:

/cache

Choose the narrower form when the same name has different meanings across projects. A top-level export folder may be disposable while a client folder with the same name contains material you need.

Avoid adding a trailing slash by habit. Syncthing documents that a pattern ending in a slash matches a directory's contents, while the form without it matches the directory too. Use the simple name form for an entire unwanted directory.

4. Put exclusions before broad include rules

The first matching line wins. This matters when a list contains an exception marked with ! and a catch-all *. The exception must appear before the catch-all or it never gets a chance to match.

For a text-only share that must exclude a trash directory, use:

.trash
(?i)!*.{md,txt}
*

Read it from top to bottom: exclude .trash, allow Markdown and text filenames, then ignore the rest. These are illustrative folder names; replace them with the names in your share.

In a July 2025 forum discussion, a user put the catch-all first and later found that a text exception also admitted trash contents. Replies fixed the ordering. That is the first thing I would inspect when an exception looks correct but has the wrong result.

5. Keep comments on separate lines

Start a comment line with //. Don't append a comment after a filename pattern. Syncthing treats those later slashes as literal characters, so the line can stop matching the filename you intended.

For a shared configuration, explain why a folder is excluded. A comment such as generated preview files gives the next person a reason to retain the rule. A comment that merely repeats the filename adds little.

Leave blank lines between groups if the list grows. Grouping by purpose helps you find an exclusion later without changing how filenames match.

Known problems and fixes

The July forum thread exposes two separate mistakes: a catch-all above an exception, and a broad exception above a directory you meant to exclude. Both are order problems. Read the first matching line for a particular file instead of reading the rule that looks most specific.

A third problem is an exclusion that works at one depth but not another. Check whether it begins with /. Root-anchored rules are narrower by design; remove the slash only when you want the same name excluded throughout the share.

Problem Cause Fix
Exceptions never work An earlier catch-all already matched Move the needed include rule ahead of the catch-all
Text files appear inside an excluded trash folder The text exception matched first Put the trash exclusion first
A child folder keeps transferring The pattern only matches the root Use a bare name when every depth should match
A rule with a comment doesn't match The inline comment became part of the pattern Move the comment onto its own line

Two variations

For a simple developer share, exclude generated directories by name and leave everything else allowed. That avoids creating an include-only list of every file type your project may eventually need. New source formats can then arrive without another configuration edit.

For a text archive, the include-only example above is narrower. Put sample files in a shallow folder and a nested folder, including one file that should be excluded. Read the destination folder after synchronization; a successful transfer message alone doesn't tell you whether your selection was right.

If you maintain many devices, #include can read a shared pattern file. The included file must exist and cannot be included twice. Keep the device's small root .stignore file, then distribute the shared rules separately before turning on a new share. This variation makes sense only when the extra file solves real duplication.

Completion checklist

  • The file is named .stignore and uses UTF-8.
  • It sits at the root of the intended share on each device.
  • An excluded example and an included example behave differently.
  • Comments occupy their own lines.
  • Catch-all rules come after the exceptions they should allow.

Next steps

Browse file utilities for related tools. For hosted recipient links, look at Dropbox or pCloud; for a server workspace, see Nextcloud. Those options change where the shared files live. Obsidian is a separate choice for reading and organizing Markdown files after your folder selection is settled.

Sources

Syncthing Ignoring Files documentation and the linked July 2025 community discussion. Official syntax checked October 9, 2026.

Related articles

Directory

Listings in this article

  • SyncThing

    Syncthing is a continuous file synchronization program that synchronizes files between two or more computers in real time. Communication is secured using TLS with perfect forward secrecy, and each device is identified by a cryptographic certificate. The protocol is documented and the source code is available on GitHub. It runs on macOS, Windows, Linux, FreeBSD, Solaris, OpenBSD and other systems, and is configured through a browser interface.