Looking for Advice on How to Best Sync a Home Folder in Syncthing

Hi all,

I’m new to Syncthing and looking for some advice on the best way to sync my home folder.

Rather than syncing my entire home directory as a single Syncthing folder, I prefer to create separate syncs for specific folders within it—such as Documents, Scripts. However, I also have several miscellaneous folders and individual files (think configuration or support files) that I’d like to include but can’t always control their location and wanted to group them all together into a sort of a miscellaneous sync instead of creating new Synced folder for each and every one of them.

My idea is to create several Syncthing folders, each starting with my home folder base path and then adding the specific folders using ignore patterns to include only the specific folders I want to sync. For example, using a pattern like:

**
!Documents/

Would this work as intended, syncing only the specified folders?

Additionally, and assuming the above is possible, I’d like to manage ignore rules more cleanly by using the #include directive to reference another file for things like temporary or other unnecessary files. If so, should I place the #include line before or after the !/ rules to ensure everything behaves correctly? For example:

**
!Documents/
#include /path/to/stignore

Lastly, is there already a generally recommended or best practice approach for syncing a home directory structure like this? I’d love to avoid resorting to a single cath-all sync of the entire home folder, if possible.

Thanks in advance for your help!

In general, it’s more efficient and less error-prone just to add single folders to Syncthing separately. However, as you’ve mentioned, if you do need to include single files or directories that are spread across many different locations, then adding the whole home directory with negated patterns in order to sync only selected paths may indeed be better.

You need to change the order like this (also no need for double **):

!Documents/
#include /path/to/stignore
*

Where you want to put #include is up to you. It’s the same as if you copied and pasted the content of the included file into the main ignore patterns. For example, if you’ve got Documents in the ignore patterns, and !Documents/**/file.txt in the included file, then the included file needs to go first.

Thank you very much for your reply, @tomasz86.

In general, it’s more efficient and less error-prone just to add single folders to Syncthing separately.

Do you foresee any issues with my approach that are less likely or could be entirely avoided if I created a traditional sync by adding separate folders to Syncthing?

Would grouping those scattered files and folders into a single sync folder using symlinks be a generally safer approach? (I see symlinks are not synced on Windows, and one of the devices is Windows, so I suppose that’s not really an option in my case).

I’m trying to figure out how to start with a reasonably solid and robust base that won’t break or require me to start over as gain some more experience and want to make some changes.

I think the approach sounds sensible :slightly_smiling_face:. Using symlinks to group the files in the same location could be an option, but as you’ve said, they’re not supported in all operating systems (like the aforementioned Windows, but also Android and possibly others).

This is much appreciated, @tomasz86. Thank you.

Windows supports symlinks. In Command Prompt as administrator, you can make a symlink with mklink, for example, mklink \path\to\symlink \path\to\file. Note that this is different from an LNK file.

Just a quick follow-up, I ended up going with a hybrid approach.

I accept that it’s generally safer to add individual folders from within the home directory as separate Syncthing folders. If nothing else, this limits the sync scope, which helps avoid unintended consequences if ignore patterns aren’t set up perfectly, such as Syncthing trying to sync the entire home directory if the ignore patterns missing an important element.

For syncing the config and support files (dotfiles for short), I created a dedicated Syncthing folder and used a selective include strategy as detailed above:

(?d).config/
(?d).local/
(?d).dotfile1
(?d).dotfile2
.
.
.
#include /path/to/stignore
*

When I added the dotfiles folder with ~ as the Folder Path, Syncthing gave a warning that it’s a parent of existing Syncthing folders, but it still allowed the folder to be created so I decided to give it a go, assuming that after setting up the ignore patterns there wouldn’t be any overlaps or conflicts.

Before sharing the folder, I confirmed the ignore patterns were working as intended and Syncthing only scans and lists the files I expect (I went by the file count. One question: is there a way to view the actual list of matched files/folders that Syncthing sees?).

So far, everything seems to be working as intended.

@marbens, the issue isn’t that Windows can’t create symlinks, it certainly can, but rather that symlinks aren’t reliably synchronized across different file systems. Additionally, Syncthing doesn’t follow symlinks, which makes this approach less helpful for the intended use.

Thanks again for all the help.

We’re talking specifically about Syncthing here :sweat_smile:. Symbolic links being ignored on Windows is explicitly mentioned in the FAQ (see https://docs.syncthing.net/users/faq.html#what-things-are-synced). Android isn’t listed in the FAQ but probably should (as Syncthing does try to sync symlinks there, but it fails, as the OS doesn’t allow creating them on the user storage).

Not in the GUI, unfortunately. I think you would need to use the API to get an actual file list…

1 Like

Too bad. In that case, my advice for anyone who might stumble upon this thread in the future with a similar idea, to start with a very small subset of files or folders and use the file and folder count as an indication whether the ignore patterns work as intended or not before sharing the folder with other devices.