is this correct syntax for the .stignore file?

I am syncing a folder called ‘sfolder’. In sfolder there a number of files and directories, as well as an .stfolder and a .stignore

In the .stignore, does it ignore blank lines? Will it ignore leading blanks? I gather from the docs that // starts a comment.

// nifty .stignore file stuff

/ad/*

  !/ad/user

  !/ad/.hidden

Will this ignore sfolder/ad directory? Well except for: sfolder/ad/user subdirectory tree, and /sfolder/ad/.hidden file?

I ask this question because syncthing issues an error that it can not read a file within one of the ignored directories. So is this something that can be ignored, or does it mean the .stignore file is not being interpreted as I expected?

Blank lines don’t matter, and if I understand correctly, what you want is something like this.

// nifty .stignore file stuff
!/ad/user
!/ad/.hidden
/ad
1 Like
/ad
!/ad/user
!/ad/.hidden

I still get an error from the ignored directory. I am syncing directory /home/bob/Sync/.

error while traversing /home/bob/Sync/ad/tmp/dump permission denied

The error is correct that it does not have permission, but why is it scanning in an ignored directory?

It’s because of the negated (!) patterns.

Also, this won’t help with the permissions denied error message, but the order does matter here, so you do need to put the ! lines first if you actually want to sync those paths.

1 Like

Say I have a directory tree:

da --\
   .stfolder
   .stignore
   da0 --\
       fa00
       fa01
   da1 --\
       fa10
       da10 --\
         da100
         fa100 <- scanning will give permission error

and given .stignore

!/da1/fa10
/da1

Then the entire da1 tree will be scanned because of the !/da1/fa10, and thus hit upon fa100 and get a permission error?

Is this what you are explaining to be the case? (This would explain the error.)

The thing is the error comes from the filesystem watcher. And that one needs to scan the entire tree if there are inclusion patterns (starting with !), so errors might also happen on ignored items.

1 Like