Useful .stignore Patterns

Please do not use relative ignores escaping the folder root, that might not work in future releases.

1 Like

hi , I have a similar use case . The background being that I use the Macosx environment (macosx Catalina)for syncing my original photo’s and videos to my PC laptop as a photo dump . I use the native picture management app called “photos.app”. this generates quite a lot of files not required to be synced .

I have tried using the fancy filters in the .stignore file however had problems with the expression <!> used to ignore the ignore pattern. ST was still syncing files other than the ones used . I think the reason is that the include feature works with the include and not otherwise . so I went about a simple way

I used the the following to include the desired format (each expression per line) !.png !.mp4 !.mov !.jpg !.jpeg !.avi !*.gif

and then I used a generic expression like this <.1> <.2> (…extend to the full series) <.a> <.b> (…extend to the full series)

this helped me get the right mix . the following expression is not likely to work .

!.png !.mp4 !.mov !.jpg !.jpeg !.avi !*.gif *

this ends up ignoring everything . I don’t know if that a bug or a feature or a limitation etc.

Because I use Syncthing and Resilio in parallel, for the Ignore lists I use as follow:

Including in Syncthing Ignorelist:

// Resilio .sync .syncID .syncIgnore .syncArchive *.bts !sync *.syncPart *.syncTemp *.syncOld

Including in Resilio Ignorelist:

// Syncthing .stfolder .stignore .stversion .syncthing* .syncthing.* .syncthing.. ~syncthing~..tmp *.Identifier

In this way is possible to have a folder in both peer lists, if needed in special cases.

how could i add the Synology Dsikstation folder “#recycle” to the ignore list? the fildername starts with an “#”

Thank you in advance

If it’s at the top of your folder, /#recycle is an option. (?i)#recycle is another which matches everywhere, case insensitively.

1 Like

I want to discuss a possible case. If I want to sync a folder but not the subfolders, I have to ignore ALL subfolders. For that / in the stignore should be work.

Is possible, that sub-folders under root level will still be created on the other remote peers (folders) and they are all empty and nothing inside them, so maybe I have just a bunch of empty sub-folders?

Further, is possible, if someone accidently delete or modify the empty folders on the remote peer sides, which were not allowed to be synced, then on the server side the original folders content lots important files, will also be deleted real quick? Maybe, because Syncthing considered that folder is no longer exist and removed it?

Maybe helps, if I had some files or folders don’t wanna to be synced, simply prefix a ~ to these folders, and they will disappear like a charm on other peers. No need to add rules into the stignore. Just prefix a ~ to ignore. Is possible to use this method on almost any folder / files?

I’d try /*/** which should match everything one level down or more.

Yep.

No. Syncthing will try, complain that the folder is not empty, and suggest that maybe you have an ignore setup like described here.

I’m not sure how you mean this to work exactly.

This should be useful!

One that should be included: “.thumbnails”, used by Android, if you share just the “DCIM” directory on an Android phone you’ll get one of those included too, so best not to sync that

1 Like

Is it ok to create a mini repository of ignore rules for each (os|applications) Either at GitHub or syncthing docs

There are many ignore rules in the form putting them in one place may help

2 Likes

If I understand correctly, you would still need to edit each and every .stignore file of every synced (root) folder on each of your devices individually, to add #include .stglobalignores.

Once you have done that, you can do maintenance for adding/removing excludes in each .stglobalignores in every synced (root) folder on 1 device (for example your NAS/homeserver), it will get synced to each node.

Am I correct?

Perhaps it is a lot easier to use the WebUI, add all ignore patterns in one folder and just copy paste it to other folders whenever you need it. However I guess you would have to do this for each node individually again… never mind.

1 Like

A centrally stored .stglobalignores would be better. Otherwise I used scripts by copying an adapted .stignore from a defined directory into the respective peer. Sure, if I change the peer list in the GUI, I may have to adjust the script as well. But it’s not that time-consuming once things have been laid out.

1 Like

So I am correct, about how it is now?

Yes, is also my knowledge.

Yes. I use ignores in this way in some instances and it works well.

But only to one related peer. If e.g. 5 devices connected to the related peer, on all devices you will find automatically the .stglobalignores in this related peer. Finally you need to repeat that for each different peer.

1 Like

Should have (?d) before it, as should probably a bunch of others.

Aren’t these lock files? And would cause problems with (accidentally) having the same document open on both machines?

Can you edit this comment to format it correctly?

Open, no. As long as you do not actually edit the document and save the changes, you should be fine.

but the lock file prevents you from saving the changes, it warns you that it’s already open and lets you open it read-only?

1 Like

Yeah, but there are cases where you do not care about that and still want to save the changes. For example, I may be working on the same document at home, and also on my laptop. Let us say that I finished working on the laptop, but then I hibernated the machine without closing the document. In that case, the lock file will stay there forever, even though the work is done and I now want to edit it on my home computer.

Of course, you can still delete the lockfile and proceed to edit the document anyway, but regardless. There are different needs and different use cases, I guess. There is really no reason to use that ignore pattern if you prefer to have the lockfile synced :wink:.

1 Like