How does Synchting handle symbolic links?

It looks like it depends on file system, operating system etc. Here is what I find in the docs:

  • Symbolic links (synced, except on Windows, but never followed)

Is there a workaround to follow the symbolic links?

I see this post, but it’s inconclusive

The symlink links to outside the Synchting folder. I want when the source data is updated, the actual data is synced in Synchting folder of the other peer (not just a link that points to nowhere).

Can someone clarify the situation as of 2024.

Yes. For example, FAT-based filesystems don’t support symbolic or hard links.

The scenario you describe above is unsupported in any combination of operating system and filesystem. If it was an option in Syncthing, there would be the question of what happens in the default “Send & Receive” mode when one side has a symbolic link while the other side doesn’t (just one of many issues).

What exactly is it that you’re trying to accomplish on the destination device?

Synchting syncs a folder in peer A to a folder in peer B. How do you sync a specific file in peer A, for example /etc/foo, to a file in peer B, for example, ~/Sync/foo?

In general, I want to sync assorted files and folders in peer A (various folders, specific dot files or files in /etc/ and so on) to the Synchting folder in peer B. I thought of creating symbolic links from those files and folders to the Synchting folder in peer A. I was hoping that Synchting will follow the links and syncs them somewhere in peer B. For example, /etc/foo is linked to ~\Sync\foo.ln in peer A which is then synced to ~\Sync\foo (actual file not a symbolic link) in peer B. The sync will be one way. A two way sync could also be implemented, but is more complicated.

Syncthing works relative to a designated starting path, so device B doesn’t care that its ~/Sync/ is receiving files from /etc/ on device A.

Then for filtering out all but specific files from a directory/folder, see:

If /etc/ and ~/Sync/ are in the same filesystem, one option is to use hardlinks instead of symlinks.

But if ~/Sync/ is on a different filesystem, one option is bind mounts (i.e. mount --bind).

(Note that it’s spelled “Syncthing” and not “Synchting”. :smirk:)

1 Like

A trick I use is to link through a shell-script.