Automatically deleting folders on a node when an ignore is added for it

I’m assuming this is as designed and there may be no way to get around this. I have a couple 100TB Nas in different locations that maintain 100% sync between them. I have third repository that only gets a limited number of the folders from the main servers. I have it set up .stignore so I list just the folders I want that device to get and wildcard everything else to be ignored. Regularly I need to remove one of those synced folders from the remote node. After I remove the exception from the .stignore it indeed stops syncing but leaves the folder sitting in its last state on the remote machine. Is there a way to force it to delete those now ignored folders? I’m just trying to set something up that requires as little human intervention and therefore error as possible.

I assume that you’ve read If not, then I’d strongly recommend to do it. In one word, you need to use (?d), but this can be a little tricky depending on your specific ignore patterns.

In fact, I believe the other topic just from today (see discusses the same problem. You can check out some of the more complex patterns in my last post there.

If you need more specific help, please post the exact ignore patterns that you’re trying to use and the folder paths that you’d like to ignore and later remove on deletion.

Thanks for the reply. Yes I have tried (?d). I think the difference here is I am not deleting any folders or files from my main sync repositories I am merely changing the folders that get ignored when syncing to the remote location. While a folder was once allowed to be synced to this one remote location, I am now saying it shouldn’t. If I physically deleted it from one of my big NAS then yes it deletes nicely in the remote location but since I am not deleting on the main NAS but just changing the ignore file for the remote location it just stops updating that folder but doesn’t actually remove it from the remote location.

Yeah, seeing your more detailed explanation, I think the whole situation can probably be summarised by saying that ignore ≠ delete. Even when using (?d), there needs to be an action of either deleting or moving something for Syncthing to actually remove the other files/folders. Just changing what you ignore without doing anything else will just influence your local state, but it will have no impact on the remote device.

I’d guess that what you want could probably be achieved by writing some custom scripts and running them on schedule on both devices, but this would likely be more of a hack than a clean solution to the question at hand :wink:.

Thanks Tomasz86. Yep thats kind of what I thought. Sometimes life is just a hack. The other way I have been doing this is appending the name of the remote server to the end of the folder names I want to share and then adding an ignore line like !/*_remote then when I no longer want it synced to the remote machine I just remove the _remote from the folder name and that forces a delete remotely since the remote machine thinks the folder was removed at the main server. the downside of this is it also triggers a major re-evaluation of the 2 100 TB servers and a lot of communication back and forth despite only the name of the folder changing for them.

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