How Do I Go About Excluding Folders?

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.

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”:

/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.

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.

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.

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

/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.:

.
└── 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.

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

No problem. :slightly_smiling_face:

1 Like

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