I have 5 machines all using xubuntu in my family and I would like to back up each to my NAS. To date I have been backing up the ‘main’ directories, Documents, Music, Pictures on each. This works fine but for each machine in my syncthing folder list I have 5 x 5 directory identical names except for the individual machine name prefix. It looks messy and unnecessary.
I would like to have a list of just 5 machine names in my folder list. To do this I would need to sync the root folder of each machine. Some 11 directories and 14 files all prefixed with ‘.’ would be synced.
Is there a way to sync the root folders but ignore those .vnc directories and .dmc files for instance? Effectively ignore anything preceded by a ‘.’, including the contents of the directories?
I have read the .stignore documentation but it is ever so complex for my need, however I wonder if there would be any unexpected results for the OS if I were to try this? Would I need some sort or ‘terminating function’.
Something sounds unclear here. In the first sentence, you mention that you’d like to sync directories that begin with .. In the following sentence, you state the you want to ignore all directories preceded by .. Please clarify which of the two you actually want .
Assuming that you want to ignore all directories in the root folder starting with ., this is what you need to put into your ignore patterns:
/.*
Please keep in mind that the pattern will ignore files beginning with . too (as there is no distinction between files and directories when it comes to ignore patterns).
You also keep using the word “backup” but please keep in mind that Syncthing is not backup software. It does make redundant copies of your data through synchronisation but if you delete or modify a file by mistake, Syncthing will happily push those changes to all connected devices. The same applies if your machine gets hit by a ransomware virus.
Yeah, so I think you just need to use the previously mentioned /.*. Please test with some temporary folders to make sure that the pattern works first before applying it to your actual data.
No, but I see that it may appear like it if you’re not accustomed to the forum formatting. I marked it as code, meaning that it should use a different background colour and a different font than the normal text, but just to be extra clear, the pattern that you need is:
/.*
The leading / means that you target items located in the Syncthing folder’s root path. . combined with * into .* means that it can be any file/folder that begins with a single ..
If you are certain that only those explicitly mentioned directories should be synced, then you can invert the patterns. Other things created later that do not start with a dot will then also be excluded.
!/Pictures
!/Documents
!/Video
/*
It tells Syncthing to ignore anything but the lines prefixed with “!”. If you add more of those, make sure to keep them above the last line with the asterisk, as the order matters here.
Thank you, it is a good suggestion. As far as I am aware only 5 such folders that I or my family would ever use are placed in the root folder.
I have a question though and that is the placement of the .stignore file. During experiments I find that any file with a ‘dot’ takes its position dependent on the characters following the ‘dot’. This means that it can be placed above the .stfolder and as folders take the highest position in the list, below the folders. I had the impression it needed to be top of the list.
The only valid placement is the root of the Syncthing folder. Is there any reason why you’re not using the Web GUI for adding the ignore patterns? You wouldn’t need to worry about the location that way.
That’s it exactly. I don’t know what else you understood, but this, as you have worded it, is the correct location.
When you share ~/ in Syncthing, the ignore patterns are read from ~/.stignore and from nowhere else. I concur with the recommendation to use the Web GUI for editing the ignore patterns and not worrying about the file location at all.
I use Windows 11 rarely but it would be an advantage to me if I were able to sync only the same 5 specific user directories as I do in Linux.
In Windows 11 is it possible to tease out the same 5 pertinent directories and apply a ‘pattern’ to sync only those 5 directories?
Edit: It would appear from research to be impracticable unless the relevant directories are moved to one specific directory and linked back to where they should be. Does that appear to be workable? I know when I was a Windows user, I always moved my relevant directories to another drive/partition.
I too do this in Linux but I was considering changing that to just the top folder with the contents being picked up by syncthing thus reducing the number of sync entries…
May I ask why you chose to sync each one individually?
Certainly! TL;DR version: It was easy to do it that way.
My use case is syncing files between a stationary Windows PC and a Windows laptop, both personally owned by me. The stationary PC has a metric boat-ton of storage and is my only machine connected to the cloud backup provider I use.
I have nine shared Folders, seven within my root Documents folder, and two from other locations. My root Documents folder has way more content that I don’t need to sync to the laptop, and it just seemed easier to set up and easier to manage for each directory to have its own Syncthing Folder. It also lets me track each Folder stats individually. Setup effort was very low.