Ignore patterns that start with "#"

I have two folders #snapshot and #recycle that I see no reason to sync between two synology NAS units. I have added #snapshot and #recycle to the ignore patterns for the appropriate folders, but syncthing seems to be syncing them still. Is the # causing a problem? Have I missed the syntax somehow?

Yeah, hash is interpreted as comment. You can try */#snapshot/*

I thought // was comment, # has no special meaning except when used for #include?

And anyway I think */#snapshot/* will not match the directory itself, for that you need to loose the trailing slash: */#snapshot.

Actually, you are right, it only should match #include, so #snapshot should work.

There is some special treatment of patterns starting with #: When parsing patterns generally a second pattern with /** appended is added to catch children. Lines starting with # do not get that. The scanner should still work fine, as it skips walking the ignored directory, but if a remote device sends you e.g. #snapshot/foo it will not be ignored. That special treatment should probably only apply to #include or is there some additional considerations here?

Also we are getting a bit off track here, maybe @calmh (or anyone with means to do so) can move this discussion to a separate thread?

It should be handled the same way in all cases. If it’s not we should open a bug ticket.

I will fix it: https://github.com/syncthing/syncthing/issues/4680

Thanks for the attention to this gentlemen. On a synology box, if you install the snapshot replication package (basically previous file versions) you get a #snapshot folder for each instance, so I think this is a worthwhile fix as it will come up from time to time.

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