Excluded folders syncing over but with empty contents, anything wrong with my .stignore?


#1

I have a sync partnership between two devices, A and B, or perhaps A to B.

A is read only and its .stignore set up to sync specific subfolders to B, ignoring the rest, like so

//DON'T ignore the following dirs (i.e. DO sync them):
!/Sync_1
!/Sync_2
!/Sync_3

// Ignore all the rest
*        <---- (e.g. Sync_4, Sync_5, etc)

On device B, I can see Sync_1, Sync_2, and Sync_3. But I also see folders that I thought I excluded with *, Sync_4, Sync_5, Sync_6 etc, along with their subfolders, however they are empty of files.

What I want: to only see Sync_1, Sync_2, Sync_3 on device B.

Do I need to set up a corresponding .stignore on Device B, like so

//DON'T ignore the following dirs (i.e. DO sync them):
!/Sync_1
!/Sync_2
!/Sync_3

// Ignore all the rest
(?d)*   <-------delete everything else

Added note, possibly related to the above problem: On device A, I now delete Sync_4, Sync_5, and Sync_6. But they remain on device B (as empty directory trees)


(Simon) #2

Your first ignore patterns are fine, (?d) is about something else. Are you sure Syncthing created those directories on B after you set up the ignore patterns? Or differently: If you delete these dirs on B, do they get created again?

That’s expected: As you ignore those directories on A, any changes (including deletes) are not picked up and thus not sent to B.


#3

Hi Simon, thank you for taking the time to respond. I have just removed the sync partnership from device B and re-added it, and this time only my specified folders sync over, so the problem appears to be solved.

I believe this was a one-off issue. While syncing the first time, I noticed that on one of the devices (unfortunately I forgot which), the initial scan would increase the number of files in “Local State”, which would then drop and increase/decrease over and over until it reached the final size. Additionally, device B was an Android device that was low on storage, and when the storage was full Syncthing would crash. Only when I cleared up storage did the sync resume.

At the same time, device A’s syncthing also crashed a few times, perhaps something linked with device B.

After the sync was complete, (having freed up storage on device B), the problem as I described surfaced, 1) with empty non-excluded folders showing up, and 2) when deleted on device A, remaining on device B.

Now with a successful removing and re-adding the partnership on device B (and making sure there was enough storage to complete the sync), “Sync_4” and other excluded folders weren’t synced in the first place. So the first problem is gone. I can’t reproduce your suggestion of deleting folders on device B now, since they never appear, and so there is nothing to delete.

I guess this must have been an edge case, perhaps caused by the Android receiving device being full during the initial sync and triggering these problems.