quick question about ignores

in the ignore syntax, does using “!” to “not ignore” something result in everything else being ignored? for example if i ONLY want to sync text files (and NOTHING else) can i use something like this:

//only sync text files !*.txt

btw input box isn’t respecting carriage return i realize there is one between the commented line and the !*.txt :slight_smile:

No, you still need to ignore everything after that, e.g.

!*.txt
/

or if it’s for just a single folder

!folder/*.txt
folder/

Please also check https://docs.syncthing.net/users/ignoring if you haven’t already.

i thought that might be the case. so “/” is ignore all?

Yeah, it means to ignore the main folder root path itself (which includes everything inside it).

perfect thanks!

ok so one of my remote devices is still receiving files that should be ignored… can you check my syntax one more time? I have it set up so my primary/NAS has NO ignore conditions and each of my remote devices has ignore conditions set. Is that the way you do it?

//only sync roms, saves, and states !.zip !.txt !*.xls /

somehow tho Word doc (.doc) files and their folders were received…

You should use code formatting (“Preformatted Text”, the </> icon in the post editor toolbar) to post such listings. Then they will have proper line breaks and not swallow * characters.

@tomasz86 Do you have any experience or advice how using a catch-all “/” pattern compares to using “*” as last entry? The latter seems more popular, but I actually like the former not relying on wildcards.

i know apologies. tho i don’t see that on the toolbar unless i’m totally missing it…

should i also add the (?d) in front of each so those folders and files will be deleted from the device once i update this? should i try an asterisk rather than a slash at the end?

1 Like

so any idea why these additional file types are sneaking through?

preformatted_text

Optionally, the HTML-syntax <pre> (preformatted) element can also be used:

<pre>
some
text
</pre>

Or, bracket the text to be preformatted with three consecutive backticks.

//only sync roms, saves, and states
!*.zip
!*.txt
!*.xls
/

Although my personal preference is * instead of / whenever I want to say “everything”, your patterns look fine.

Are you manually creating the .stignore text file? If so, where are you putting it?

hmmm no i am creating w/ the syncthing gui. on which folder should these ignores be placed? sending or receiving system/device? rn i have NO conditions on my primary/NAS and conditions on each of my devices to control what they send and receive (ideally). i’m going to try * instead of /.

//comment
!*.zip
!*.txt
!*.xls
*

PS - if i manually delete the offending folders and files from one device only should i: 1) set the device to “receive only”, 2) delete the folders and files, and 3) set back to send and receive? trying to avoid deleting the folders and files on the primary/NAS and other devices too.

Note that the ignore patterns are bidirectional – filtering both outbound and inbound files/folders.

Put aside Syncthing for a moment and consider the following scenario…

You’re at a restaurant taking orders from customers. Would you rather individually note whether each customer wants a glass of water, or would you rather have a single note that says nobody wants water?

So if you place the ignore patterns on the sending device, every receiving device will receive whatever list of files/directores are to be sent after the patterns have been applied, plus you only have one .stignore file to manage.

If there are only two devices, it really doesn’t matter. But if you’ve got 100 devices connected to one device and you want to exclude something from being sent to the 100 downstream devices, it might make a difference from a maintenance perspective.

On a related note, Syncthing also has a handy #include directive for importing patterns from other files so there are several ways to slice and dice things. There are plenty of tips and how-to posts on this forum.

1 Like

No, don’t do that. As soon as you switch it back to “Send & Receive” the deletion will propagate to the other devices because Syncthing is being told to sync the local state to its peers.

Instead, you should get your ignore patterns working first so that Syncthing ignores the unwanted files/folders. Then you can delete them without the change spreading to the other devices. No need to switch back/forth from “Receive Only” and “Send & Receive”.

And of course, always have adequate backups… :wink:

ok thanks for that, makes sense. that said, i’m still struggling to figure out what’s wrong with my syntax that’s allowing offending files through the ignores though. let’s simplify this to just two devices. the folder on my primary/NAS has the following:

//only sync roms, saves, and states
!*.zip
!*.gb
!*.gbc
!*.gba
!*.nes
!*.sfc
!*.z64
!*.nds
!*.3ds
!*.rvz
!*.p8.png
!*.srm
!*.state
*

and the “remote”/2nd device has the following:

//only sync roms, saves, and states
!*.zip
!*.gb
!*.gbc
!*.gba
!*.nes
!*.sfc
!*.srm
!*.state
*

somehow though, file types OTHER THAN those in the de-facto whitelist above are getting through… for example z64 and nds and p8 are all getting through but, inexplicably, n3ds and rvz are not!!!