Syncthing syncs files that should be ignored

Hi,

I have been using Syncthing for ~2 years now and recently I installed Synctrayzor on Windows (via winget install GermanCoding.SyncTrayzor) to sync my local user’s “home” directory to my NAS. I always had troubles with .stignore files and keeping them in sync and ignoring unnecessary junk (such as system files and cache, etc.) so now my technique is to ignore everything in the sync root folder and only selectively enable sync for certain files and folders, which I actually care about, but for some reason it is not behaving as I expect it to.

Here is my .stignore on both clients:

#include stignore.txt

And here is stignore.txt:

!.bash_history
!.bash_profile
!.bashrc
!.gitconfig
!.ssh/
!.vscode-oss/
!.adb/
!.config/tacky-borders/
Documents/
!Downloads/
!Pictures/
!Videos/
!Sync/
*
node_modules/

(Documents/ is ignored intentionally for now)

And for some reason this is what ended up on my NAS:

semmu@toaster:/hdds/syncthing/semmu-y520-win10-ent-home$ ls -hal
total 84K
drwxr-xr-x 11 semmu semmu 4.0K May 25 13:13 .
drwxrwxr-x 14 semmu semmu 4.0K May 25 00:42 ..
drwxr-xr-x  3 semmu semmu 4.0K May 25 01:18 AppData
-rw-r--r--  1 semmu semmu 9.1K May 25 13:13 .bash_history
-rw-r--r--  1 semmu semmu   99 Sep 24  2025 .bash_profile
-rw-r--r--  1 semmu semmu  194 Apr 15 15:26 .bashrc
drwxr-xr-x  3 semmu semmu 4.0K May 25 01:03 .config
drwxr-xr-x 28 semmu semmu  20K May 25 02:44 Downloads
-rw-r--r--  1 semmu semmu   76 Oct  9  2025 .gitconfig
drwxr-xr-x  7 semmu semmu 4.0K May 25 02:33 Pictures
drwxr-xr-x  2 semmu semmu 4.0K May 25 01:18 .ssh
drwxr-xr-x  2 semmu semmu 4.0K May 25 00:42 .stfolder
drwxr-xr-x  2 semmu semmu 4.0K May 25 02:36 Sync
drwxr-xr-x  5 semmu semmu 4.0K May 25 02:44 Videos
drwxr-xr-x  4 semmu semmu 4.0K May 25 01:03 .vscode-oss
semmu@toaster:/hdds/syncthing/semmu-y520-win10-ent-home$

As you can see there is an AppData/ folder for some reason with various junk file inside which I don’t care about:

semmu@toaster:/hdds/syncthing/semmu-y520-win10-ent-home/AppData$ find .
.
./Local
./Local/Programs
./Local/Programs/VSCodium
./Local/Programs/VSCodium/resources
./Local/Programs/VSCodium/resources/app
./Local/Programs/VSCodium/resources/app/out
./Local/Programs/VSCodium/resources/app/out/vs
./Local/Programs/VSCodium/resources/app/out/vs/sessions
./Local/Programs/VSCodium/resources/app/out/vs/sessions/skills
./Local/Programs/VSCodium/resources/app/out/vs/sessions/skills/sync
./Local/Programs/VSCodium/resources/app/out/vs/sessions/skills/sync/SKILL.md
./Local/npm-cache
./Local/npm-cache/_npx
./Local/npm-cache/_npx/35c48adf706267bc
./Local/npm-cache/_npx/35c48adf706267bc/node_modules
./Local/npm-cache/_npx/35c48adf706267bc/node_modules/escalade
./Local/npm-cache/_npx/35c48adf706267bc/node_modules/escalade/sync
./Local/npm-cache/_npx/35c48adf706267bc/node_modules/escalade/sync/index.js
./Local/npm-cache/_npx/35c48adf706267bc/node_modules/escalade/sync/index.d.ts
./Local/npm-cache/_npx/35c48adf706267bc/node_modules/escalade/sync/index.mjs
./Local/npm-cache/_npx/35c48adf706267bc/node_modules/escalade/sync/index.d.mts

So my question is: why did these files end up being synced? Is there something wrong with my stignore.txt? I will admit I cannot wrap my head around how it works (I’m very used to .gitignore and others, and Syncthing ignore list works differently) and also I would love a simple addition to the web GUI to list which files are currently tracked by Syncthing (and even which ones are being intentinally ignored as the result of the ignore list).

Thanks in advance!

The usual cause is that this folder was synced before ignore patterns were applied. Syncthing does not remove ignored files, but unless you had these ignored patterns present from the very first second of sync they may have already went through.

(Also, since you’re using #include patterns: this can make this even more likely, since the included file may need to be synced before the relevant device can apply it, but in the meantime the include will not work)

Yeah, this may have been what happened indeed.

After re-reading the docs about ignoring files I updated my stignore.txt and also removed the already sync’d junk files from my NAS and this is how it looks now:

$RECYCLE.BIN
$WINDOWS.~BT
(?d).DS_Store
(?d)Thumbs.db
(?i)desktop.ini
node_modules
!/.bash_history
!/.bash_profile
!/.bashrc
!/.gitconfig
!/stignore.txt
!/.ssh
!/.vscode-oss
!/.adb
!/.config/tacky-borders
/.config/tacky-borders/tacky-borders.log
!/Documents
!/Downloads
!/Pictures
!/Videos
!/Sync
*

Also the fact that the first matching rule decides the fate of a file/folder really forces me to think hard about how to order my ignore list, haha. I hope this one will work as I expect it.