I recently wrote my own Python script to sync configuration files and a few other files between the systems on my LAN and someone suggested looking into Syncthing.
After looking over the FAQ and checking it out, I have three questions:
It looks like Syncthing is set up to sync directories. What about syncing single files? I have a few programs that have single files in ~/Library/Preferences, but I wouldn’t want to sync t hat entire directory. Is it possible to sync single files instead of entire directories?
I’ve seen references to Syncthings creating a .stfolder directory in directories it syncs. I get that this is done as a way to verify Syncthing can write to a directory, but it seems a messy way to do that. Is there a reason it can’t do a test write and catch or trap errors if it doesn’t work?
I see references to Syncthing using external servers and understand the time on those servers is donated and so on - but will it be doing that even if the only computers I am syncing are on my LAN? And does it need to be able to do that to function? I’m in a rural area and there are times internet just goes out, so relying on it to sync my files would be a problem.
What’s frustrating is I had searched for sync programs to do this and Syncthing didn’t show up - don’t know why. So I wrote my own script and after that, someone told me to look here. Well, that’s a few days I won’t get back!
With the information in your answers (and I see I had just forgotten part of what I read about the .stfolder as I moved on to my next issue), it looks like I might be able to do what I need to with Syncthing - and it works in the background. (My program needs to be run by hand for each sync.)
“Discovery” of devices is performed via the public discovery servers, by using local broadcasts, recently-used IP addresses and any hardcoded addresses in each “Device” config, so you shouldn’t have a problem with local discovery. Other online features such as relays don’t apply locally so you should find it Just Works.
I’ve looked through the Ignore section and I want to make sure I’m reading this correctly - and imagining how to do it correctly. This is the key passage:
A pattern beginning with a ! prefix negates the pattern: matching files are included (that is, not ignored). This can be used to override more general patterns that follow.
I need preference files for iTerm2 and, for now, let’s say I need them for an imaginary program called Dwimnwis (as in “Do what I mean not what I say”). Everything else is ignored. So I think I can write a .stignore file like this:
As I read it, it’ll ignore every file in the directory (and every directory) EXCEPT the ones that include “iterm” and “dwimnwis” as part of the file name. Those that meet those two criteria will be synced, while the rest of the directory is ignored.
Okay, I understand that now. Glad my traffic is kept local for multiple reasons. (I get that the external systems can’t read my data, but in terms of not using the internet when it’s not needed, and might be out here, is good.)