# How Do I Go About Excluding Folders?

**URL:** https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114
**Category:** Support
**Created:** [May 10, 2024, 6:33pm UTC](https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114 "2024-05-10T18:33:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![MrGeekman](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@MrGeekman](https://forum.syncthing.net/u/MrGeekman)
#### Post date: [May 10, 2024, 6:33pm UTC](https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114/1 "2024-05-10T18:33:45Z")

</div>

Ideally, I’d like to include the file path so I can be sure that only that one folder will be affected. I know a bit about ignore patterns, but I’m not sure how to go about it with a file path.

---

<div class="post-metadata">

### Author: ![gadget](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@gadget](https://forum.syncthing.net/u/gadget)
#### Post date: [May 10, 2024, 11:22pm UTC](https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114/2 "2024-05-10T23:22:18Z")

</div>

To exclude a specific folder, end the pattern with a folder separator (`/`), e.g. your `.stignore` would look like this if you wanted to ignore a folder named “folder”:

```plaintext
/ignore/the/path/to/this/folder/

```

A file named “folder” under the path `/ignore/the/path/to/this/` would not match the pattern, so it would be synced as usual.

---

<div class="post-metadata">

### Author: ![MrGeekman](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/5f8ce5/32.png) [@MrGeekman](https://forum.syncthing.net/u/MrGeekman)
#### Post date: [May 11, 2024, 3:13am UTC](https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114/3 "2024-05-11T03:13:14Z")

</div>

How about spaces? Also, how far back do I need to go into the file path? Can I just go as far as the shared folder? To make it a bit easier, here’s the file path subdirectory/subfolder I’d like to exclude

_/Documents/Home/Physical Media Copying/Subtitles/_

Should I use a tilde at the start?

I’m sorry for asking you all of these questions, but I’m leaving for a trip on Monday morning and I really want to get this squared away ASAP. I’ve tried a few different things, but they haven’t worked and I don’t want to add too much wear to the SSDs in my desktop and laptop repeatedly transferring a 28GB folder back to my desktop.

---

<div class="post-metadata">

### Author: ![gadget](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/g/dec6dc/32.png) [@gadget](https://forum.syncthing.net/u/gadget)
#### Post date: [May 11, 2024, 4:41am UTC](https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114/4 "2024-05-11T04:41:38Z")

</div>

> [@MrGeekman](#):
>
> How about spaces? Also, how far back do I need to go into the file path? Can I just go as far as the shared folder?

A pattern is relative to the base/root of the shared folder, so if the shared folder in Syncthing is configured as `~/A/B/C/D`, the pattern starts after `D`.

Syncthing treats spaces in a pattern just like other non-special characters so just use them as-is.

> [@](#):
>
> To make it a bit easier, here’s the file path subdirectory/subfolder I’d like to exclude
> 
> _/Documents/Home/Physical Media Copying/Subtitles/_

Given the path above, if the “Folder Path” in Syncthing is set to `/Documents/Home/`, then one possible ignore pattern is this:

```plaintext
/Physical Media Copying/Subtitles/

```

The first “/” at the beginning is important because it “anchors” the pattern to `/Documents/Home`, otherwise the pattern would match all instances, e.g.:

```plaintext
.
└── Documents
    └── Home
        ├── Backups
        │ └── Physical Media Copying
        │ └── Subtitles
        └── Physical Media Copying
            └── Subtitles

```

In the sample folder tree above, leaving out the first “/” in the pattern `Physical Media Copying/Subtitles/` would end up catching both `Subtitles` folders (including the one under the `Backups` folder which might be important).

Note that ending a pattern with a “/” guarantees that only folders will match it and not files, but it also means that only the contents of the matching folder will be ignored – i.e. on the receiving end it’ll be an empty folder. If that’s not ideal, leave out the final “/”, but be careful not to create any files with the same name as what would have been a folder.

> [@](#):
>
> Should I use a tilde at the start?

Only if a tilde is actually part of a file or folder name you’re trying to match.

> [@](#):
>
> I’m sorry for asking you all of these questions, but I’m leaving for a trip on Monday morning and I really want to get this squared away ASAP. I’ve tried a few different things, but they haven’t worked and I don’t want to add too much wear to the SSDs in my desktop and laptop repeatedly transferring a 28GB folder back to my desktop.

No problem. 🙂

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [June 10, 2024, 4:42am UTC](https://forum.syncthing.net/t/how-do-i-go-about-excluding-folders/22114/5 "2024-06-10T04:42:29Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
