Opposite of .stignore - feature request?

I need something like the opposite of a .stignore file, I have a directory in which there are just a few files I want to synchronise, it would be a real chore to add all the files I don’t want to synchronise to .stignore.

Also, when I add a new file to the directory, I don’t usually want it to be synchronised. Using .stignore the default is that any new file will be synchronised, I want the opposite.

Is this a reasonable feature request?

1 Like

Yes, thanks, I just realised that this was the way to do it while reading the documentation.

(Note to self, I must read the documentation some more!)

1 Like

… however, shouldn’t it be:-

!someFileToSync !someOtherFile *

Bah, auto-formatting forums.

Shouldn’t that be:-

1 Like

Yes, it probably should.


Did you figure out the proper use case? I want to go with this route as well.

Yes, as above the correct way to do it is to list the files you want to synchronise first (with the !) of course and have a * at the end. It’s best if you can have the same list at both ends hence using a .stignore file that is just an include directive pointing at the actual file with the list is the neatest way to do it.

So what I have on each system where the ‘sparse’ folder is being synchronised is as follows…

In .stignore:-

#include .stfiles

In .stfiles (you can call it what you like of course):-

// This works as an include list by using !filename to include a file and
// putting * at the end to ignore all files not explicitly included.  It
// is used with a #include in .stignore so that the list gets copied to
// synchronised systems

Note that .stfiles has !.stfiles in it so that the file list itself is synchronised. Obviously your list of files would be different.



Thanks for the tip. It works except that I was not able to get the .stignore to sync as well (on Android)

.stignore is explicitly excluded by syncthing, that’s the reason for doing the #include. You only need to create the same .stignore on all your systems once as it never changes, the changes are always in the included file.


Thanks I will do it that way.

I was trying to find it in the docs, mind linking?

I’m out in the sticks on a river in Portugal at the moment. If no one else has answered by the time I get back to the UK (26th June) I’ll try and find it then.

https://docs.syncthing.net/users/ignoring.html, surely?


Thanks Jakob!

I was wandering when is the .stignore reread and the ignore pattern regenerated? Since in this case (using #include) the .stignore is not touched so syncthing could not know that something has changed.

On each scan.

What is the advantage of having the same content in .stignore on both sides of the sync? What is the use case?

The sender will only sync the files that are “allowed” in .stignore. On the receivers side only those files which match the “allowed” rules have been synced, so ruleset and and synced files are concurrent, the .stignore ruleset has nothing to ignore, or am I missing somehting here?!

I have written “allowed” in double quotes, but I know it should actually say “not ignored”.

I think this is the new site record for thread resuscitation. :slight_smile: Have a badge.

Should I apologize?

Just recommended this thread to a couple of newly opened discussions with similar topics and then realised that I actually didn’t quite understand the concept behind Chris’ .stfiles idea.

If you don’t understand, you gotta ask.