.stignore Syntax and Patterns
The .stignore file tells Syncthing which files and directories to exclude from syncing in a given folder. It is placed in the root of the synced folder and follows a glob-based pattern syntax.
.stignore is per-folder and per-device. Each device can have its own .stignore — one device may ignore cache files while another may not. Understand global vs device-specific ignore rules.
Patterns in .stignore match against paths relative to the synced folder root. A pattern without a / can match at any depth. A pattern starting with / only matches the folder root.
File Location
/var/www/html/uploads/
├── .stignore ← Place here (folder root)
├── images/
└── cache/
The .stignore file itself is synced to all peers unless you ignore it. This means ignore rules can be shared globally (one .stignore for all peers) or kept local using the #include directive.
Basic Syntax
# This is a comment
# Lines starting with # are ignored
# Ignore a specific file
secret.txt
# Ignore a file type anywhere in the folder tree
*.log
*.tmp
*.cache
# Ignore a specific directory
node_modules
# Ignore a path relative to the folder root (leading slash = absolute)
/cache
# Ignore all .txt files in a specific subdirectory
/docs/*.txt
Special Markers
| Marker | Meaning |
|---|---|
// | Two forward slashes = rest of line is a comment |
! | Negate the following pattern (un-ignore) |
(?i) | Make the following pattern case-insensitive |
#include <file> | Include patterns from another file |
Pattern Rules
| Pattern | What it matches |
|---|---|
*.log | Any .log file at any depth |
/*.log | .log files only in the root of the folder |
logs/ | Any directory named logs at any depth |
/logs/ | A directory named logs only at the root |
foo/** | Everything inside foo/ recursively |
? | Any single character (not path separator) |
[abc] | Any single character from the set |
[!abc] | Any character NOT in the set |
Working Examples
Ignore build artifacts and caches
# Node.js
node_modules/
.npm/
dist/
build/
# Python
__pycache__/
*.pyc
*.pyo
.venv/
.env
# General
*.log
*.tmp
*.bak
*.swp
.DS_Store
Thumbs.db
Ignore temp files for common applications
# LibreOffice lock files
.~lock.*
# Microsoft Office temp files
~$*.docx
~$*.xlsx
~$*.pptx
# Vim swap files
*.swp
*.swo
# JetBrains IDE
.idea/
# VS Code local settings
.vscode/
WordPress / PHP server folder
# WordPress cache plugins
/wp-content/cache/
/wp-content/upgrade/
# Object cache
/wp-content/object-cache.php
# SQLite (if using WP SQLite plugin)
*.db-wal
*.db-shm
# Debug log
/wp-content/debug.log
# Uploads cache (if a CDN handles delivery)
/wp-content/uploads/cache/
The #include Directive: Device-Specific Rules
The .stignore file is normally synced to all peers. If you want some rules to be local only (not shared with peers), use #include:
// Global rules for everyone
*.log
// Pull in local device-specific rules (NOT synced)
#include .stignore-local
Then create .stignore-local on each device (add it to .stignore so it's not synced):
.stignore-local
Negation Patterns
You can un-ignore something with !:
# Ignore all log files
*.log
# But keep error.log
!error.log
Order matters. Rules are evaluated top-to-bottom. Put your negation patterns after the rule they override.
Case-Insensitive Matching
On Linux (case-sensitive filesystem), use (?i) to match regardless of case:
# Ignore Thumbs.db case-insensitively (handles THUMBS.DB, thumbs.db, etc.)
(?i)thumbs.db
(?i).DS_Store