Hello - I am having a bit of trouble with the ignore file.
I have sync thing on a remote server. I am trying to only allow for syncing of folders and MKV, MOV, AVI and MP4 files from the remote folder to my local computer.
If I understand correctly, you’d like to sync any files with the file extensions AVI, MOV, MP4 and/or MKV, mirroring the folder tree as required. If so, then…
(?i)!*.avi
(?i)!*.mkv
(?i)!*.mov
(?i)!*.mp4
**
… or as a more compact pattern set:
(?i)!*.{avi,mkv,mov,mp4}
**
(?d) is for an ignore pattern, so not needed with an include pattern, and the double asterisk at the very end covers everything else, so the (?d) prefix isn’t necessary.
Remote (after file has been torrented):
the.simpsons.s01e01
-the.simpsons.s01e01.mvk
-the.simpsons.s01e01.NFO
Local: (after syncing - your ignore pattern is applied here)
the.simpsons.s01e01
-the.simpsons.s01e01.mvk
If I delete the the.simpsons.s01e01 folder, the remote would delete the entire folder with the .NFO file. So on the remote server, the settings would be (?d)** correct?
But otherwise, yes. In order to satisfy the pattern match, any directories along the path would be created as needed.
And as you probably already know, the (?i) prefix enables case-insensitive pattern matching, so a file named The.Simpsons.S01E01.MKV would also be included.
So you want to delete the the.simpsons.s01e01 folder on the “Local” device and have that reflected on the “Remote” device? – the phrase “the remote would delete” makes it a bit unclear where you’re manually deleting it.
I don’t think Syncthing can do what you want. By your patterns, you’re ignoring all folders, which means Syncthing isn’t managing them and won’t delete them. They get created anyway when files are synced, as needed to contain them.
I think I’m better off explaining the full scenario. I have a seedbox that has a torrent client. It downloads the media files and then sync thing syncs it to my computer for me.
The torrent client has an unpack feature that unpacks any media if it needs to be. I want to avoid downloading unnecessary files as well so I had the above mentioned rule pattern.
What I am trying to figure out is, when the folder from the remote server is synced to my local computer; it will only contain one of the 4 mentioned extensions. The folder on the remote server for example, could have a .zip or .NFO file.
When I initiate the delete of the folder on my local, I would like it so that syncthing deletes the entire folder on the remote server, even if it includes files that were not synced.
On the server side, ignore the files you don’t want to sync, e.g. (?i)(?d)*.{zip,txt,nfo,srt} etc., with the delete flag (?d). Unfortunately, we can’t use the reverse (!-expression) because I see no way to avoid matching the folders themselves then.[1] We need to not ignore the folders, because it’s deleting the folder that triggers the deletion of the (?d)-flagged files within the folder.
You might get empty directories synced to the receiving end if the srt files etc are in a subdirectory. I don’t see a good way to avoid this.