> ## Content Index
> Fetch the complete content index at: https://developerinsider.co/llms.txt
> Use this file to discover other available public pages before exploring further.

# Syncthing .stignore Examples: Ignore Files by Extension, Folder & Pattern Type
- URL: https://developerinsider.co/syncthing-stignore-examples-ignore-files-by-extension-folder-pattern-type/
- Published: 2025-09-15T03:30:00.000Z
- Updated: 2025-09-15T05:19:03.000Z
- Author: Vineet Choudhary
- Tags: Wiki, Syncthing, Tips and Tricks, stignore, Self-Hosted

Syncthing uses `.stignore` files (similar to `.gitignore`) to exclude files and folders from synchronisation. Place the `.stignore` file in the root of your synced folder.

## 1\. Basic Syntax

- `*` \- Matches any sequence of characters (except `/`)
- `**` \- Matches any sequence of characters (including `/`)
- `?` \- Matches any single character
- `!` \- Inversion of the given condition (i.e. do not exclude)
- `(?i)` \- Prefix indicating that the pattern should be matched without case sensitivity
- `(?d)` \- Prefix indicating that the file can be deleted if preventing directory removal

## 2\. Common Patterns

### 2.1\. Files by Extension

```
*.log           # All log files
*.tmp           # Temporary files
*.cache         # Cache files
*.bak           # Backup files
*.swp           # Vim swap files
*~              # Backup files ending with ~
temp*           # Ignore files/folders starting with "temp"
*cache*         # Ignore anything containing "cache"
file?.txt       # Ignore file1.txt, fileA.txt, etc.

```

### 2.2\. System Files

```
.DS_Store       # macOS Finder metadata
Thumbs.db       # Windows thumbnails
desktop.ini     # Windows folder settings
.Trash-*        # Linux trash
$RECYCLE.BIN    # Windows recycle bin

```

### 2.3\. Development Files

```
node_modules/   # Node.js dependencies
.git/           # Git repository data
.vscode/        # VS Code settings
.idea/          # IntelliJ IDEA settings
__pycache__/    # Python cache
*.pyc           # Python compiled files
build/          # Build directories
dist/           # Distribution directories

```

### 2.4\. Folders

```
temp/           # Entire temp folder
*/logs/         # logs folder in any subdirectory
**/cache/       # cache folder at any depth

```

## 3\. Advanced Patterns

### 3.1\. Negation (Include Exceptions)

```
temp/               # Ignore temp folder
!temp/important.txt  # But keep this specific file

```

### 3.2\. Case Sensitivity

```
(?i)*.PDF       # Case-insensitive PDF files
(?i)readme*     # Case-insensitive readme files

```

### 3.3\. Regular Expressions

```
(?i)\.jpe?g$    # JPEG files (case-insensitive)
^\d{4}-\d{2}    # Files starting with date pattern (YYYY-MM)

```

### 3.4\. Path-Specific Patterns

```
/root-file.txt      # Only in root directory
**/deep/file.txt    # file.txt in any "deep" folder
docs/*.pdf          # PDF files directly in docs folder
docs/**/*.pdf       # PDF files anywhere under docs
```

## 4\. Common Gotchas

1. **Leading slash matters**: `/file.txt` only matches in root, `file.txt` matches anywhere
2. **Trailing slash for folders**: Always use `folder/` for directories
3. **Case sensitivity**: Default is case-sensitive (use `(?i)` for case-insensitive)
4. **Escaping**: Use `\` to escape special characters: `\*.txt` matches literal "\*.txt"
5. **Comments**: Lines starting with `#` are comments
6. **Empty lines**: Ignored, use for organization

## 4.1\. Quick Reference Card

| Pattern     | Matches                          |
| ----------- | -------------------------------- |
| \*.ext      | All files with extension         |
| folder/     | Entire folder                    |
| \*\*/file   | File at any depth                |
| \*/file     | File in immediate subdirectories |
| file?       | Single character wildcard        |
| !pattern    | Exception (don't ignore)         |
| (?i)pattern | Case-insensitive                 |
| /pattern    | Root directory only              |

## 5\. Practical Examples

### 5.1\. Programming

```
# Dependencies
node_modules/
vendor/
.venv/
venv/

# Build artifacts
build/
dist/
*.exe
*.dll
*.so

# IDE files
.vscode/
.idea/
*.sublime-*

# OS files
.DS_Store
Thumbs.db

```

### 5.2\. Docker Container Volumes Sync

```
// macOS system files
.DS_Store
._*
._.DS_Store
._Network

// Syncthing ignore file itself
.stignore

// Log files - anywhere in directory structure
**/log
**/Log
**/logs
**/Logs
**/*.log

// Log directories - anywhere in directory structure
**/log/
**/Log/
**/logs/
**/Logs/

// Syncting config
!syncthing/config.xml
syncthing/*

```

## References

- [Official Documentation](https://docs.syncthing.net/users/ignoring?ref=developerinsider.co)