How to sync files matching a path

Greetings. First time syncthing user here. I’m struggling to get the ignore patterns I need, and would appreciate some guidance. I want to sync all scripts (*.sh) one folder down from the root, but syncthing does not have access to a deeper subfolder, so I want to ignore it. I thought the following should work:

!/*/*.sh
*

However, I get

error while traversing /data/docker/mongo/data/db/journal: permission denied

Given it’s not working, I tried a couple of simpler scenarios - they wouldn’t sync the data I need, but I thought both should work and not be bothered by the db folder.

Example 1 (does not complain):

!/*.sh
*

Example 2 (fails, complaining about /data/docker/mongo/data/db/journal):

!/stuff/*.sh
*

The documentation seems quite clear:

A pattern beginning with / matches in the root of the folder only. /foo matches foo but not subdir/foo.

So why is !/stuff/*.sh looking in /data? Any pointers on what I should be using?

I’m using 1.18 under docker on Ubuntu if it matters.

Ah, but then I reread the note…

Note

Include patterns (that begin with !) cause Syncthing to traverse and watch the entire directory tree regardless of other ignore patterns.

Top-level include patterns are treated as special cases and will not force Syncthing to scan the entire directory tree. For example: !/foo is a top-level include pattern, while !/foo/bar is not.

So it seems you cannot do what I want.

Try to change permissions to this folder and its files to make it readable for Syncthing.

sudo chmod 755 -R /data/docker/mongo/data/db/journal

If the issue still exists, you can still ignore panic messages and see whether the sync work is affected.

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