Using a root directory containing symlinks to content folders to sync

Referred by calmh to the forum - Link of Issue

"Symlinks as root directory"

Hi, I am having problems with the following scenario. I’m on Windows 10 running syncthing with high privileges. Now I have a directory structure on the windows machine like: C:\Videos – Archive – Personal – Friends C:\Music – 1 – 2 – 3 – 4 C:\Pictures – 2010 – 2011 – 2012 – 2013 – 2014 – 2015 – 2016 – 2017 C:\Documents – House – Garden – Ebay – Tickets I really need a view of all that folders (well organized and referenced by a lot of windows links (.lnk files) to each other for documentation. I do not like to rearrange them into another directory structure because its proven optimal for my office work and everything is linked with explorer links. Some folders contain sensible private data and others don’t

I’d like to sync some of the folder from first and second level of C:\ to my sdcard using syncthing. My view should be like this: C:_virtual_folder_phone_sdcard_view – Documents ---- Tickets – Pictures ---- 2016 ---- 2017 – Music – Videos ---- Personal

I already managed to allow syncthing to access the full sdcard with write access under android - works fine. But the more folders I have, the more I have to separately fill in and handle and document within syncthing. I dont need special settings like free disk space, smallest first, ignore fat fs rights, … different for each folder. My best way to achieve this was writing a self-documentary batch script with “mklink /d TARGET SOURCE” commands to create real links (symbolic directory links) within “C:_virtual_folder_phone_sdcard_view” containing above subfolders (parseable by explorer and sync software like syncback free).

Syncthing 14.26 and 14.37 were tested by me and count 0 files and folders in the virtual folder so I suspect syncthing not parsing the symlinked folders. I need this feature and would like to suggest an improvement at this point for the syncthing project. Basic parse support would be sufficient. So no exact copy of symlinks between different file systems or OS is needed. Just the way, windows explorer also travserses the symlinked content and represents this to apps like SyncBack Free, Word, …

The workaround I tried with the ignore list also does not fit very well. I have one Syncthing Folder “C:” containing all my stuff without exceptions and this is linked with my second windows machine. (It should keep the second machine up2date with the masters data excluding OS folders). Yesterday I tried to create a second syncthing folder in the library called “C:_to_phone” and tried to set the ignore patterns so the above mentioned folders only get synced without using the C:\virtual_phone_view folder. But then I noticed I can always have a single “.stingore” pattern for one and the same directory in syncthing leaving me again with the need to make a virtual folder containing symlinks and having the chance, to make a view of the filesystem in order to sync it with syncthing. (and plus having a stignore file when needed).

Can you please give me a hint what I can do or if I can support those feature enhancements positively?

Kind regards

There’s two subtly different issues here.

  • “Symlinks as root directory”: that is, c:\foo is a symlink to c:\bar\baz, and you tell Syncthing to sync c:\foo. This should work but apparently doesn’t on Windows, per the issue you quoted. This issue can always be worked around by simply telling Syncthing the real path to the folder root.

  • “Using a root directory containing symlinks to content folders to sync”: that is, c:\foo\baz is a symlink to c:\bar\baz, and you tell Syncthing to sync c:\foo. This requires Syncthing to follow symlinks inside the folder root and is not supposed to work.

I understand that the latter would be convenient when you have data in a bunch of different places that you want to gather together and sync as one folder. Nonetheless it’s not supported and there are no plans to support it. The obvious workaround is to invert the direction of the symlinks or, if that isn’t possible, use separate Syncthing folders.

Note that under Linux and other UNIX systems it is quite easy to work around the 2nd issue as well by using mount --bind. Maybe Windows provides a similar feature.

Thank you both for replying. I did invert the symlink direction and now its fine. mount --bind, after a quick google search I took, seems to equal the subst or DosDevices-Mount Method in Windows. This is a good idea in general but does not fit my needs because I can only mount a directory to a new drive letter (but syncthing cannot attach to a bunch of drive letters… of course)

Maybe a future version can implement something like a windows library, just a second thought after recognizing symlinks can be difficult to handle accross different OS/FS. A windows library virtually builds up directory root containing sub-directories from any other place the user selects on a specific hard disk. Such a virtual library in syncthing would have the advantage, the user does not have to touch his file system probably earning the disadvantage fooling other apps or backups with explorer.

What do you think?