I want to sync a folder between a Linux machine and my Android phone. The folder has a bunch of symlinks, and on Android, I want to sync the folder to the external SD card.
The problem is that, on Android, the symlinks fail to sync, since the SD card is formatted in a FAT filesystem that does not support them. This just makes the folder “Out of sync” on Android.
Syncthing does sync everything else just fine though, but then still displays “Out of sync” on the folder. Is there a way to set a wildcard ignore pattern or something to ignore all symlinks, without having to update the ignore pattern to also match new symlinks each time I create one?
You can’t ignore symlinks specifically, so the only way would be to just add them one by one to the ignore patterns. However, Syncthing should still sync all other files regardless of the symlink-related errors. If that’s not the case, please post screenshots showing your Syncthing Web GUI on all affected devices. Log files are always welcome too.
Yeah, unfortunately there’s nothing like that for now. The only semi-automatic solution that I can think of would be to run some kind of a script on the Linux side to find all symlinks and add them to the ignore patterns automatically.
Welp, fair. I guess I’d rather live with a red sign than that though; because then I’d either run into problems of syncing those symlinks to other capable machines (the folder is synced from that Linux host to hosts, not just Android), or deal with even crazier automation methods on Android.
It could be, although this may be tricky to implement, as ignore patterns don’t really accept any advanced filetype-related patterns other than basic wildcards and ranges. As of right now, it’s not even possible to distinguish between files and directories .
I think you could still automate it by running the script on Linux and add the patterns to a separate file, e.g. .stignore-android, and then on the Android side, just add #include .stignore-android to the ignore patterns there. You can even update the patterns on Linux later on, and Syncthing on Android will pick them up automatically.
Oh yes, just checked with Termux, and Android does indeed disallow spawning symlinks in shared internal storage as well. That does sound like a reasonable request.
I’d imagine there can be some fringe use case outside of Android’s intended functioning where a user forces Syncthing to sync a folder outside of normal user storage, which would then allow symlinks, but that doesn’t sound like worth accounting for.
Oh yeah. I’d imagine, for consistency, it would be reasonable to apply the same approach as on Windows: symlinks sort-of-exist and can technically be used, but are generally unsupported and not intended to be used by the OS developers. (after all, Windows does support symlinks to my knowledge and experience)
But indeed then there’s the question of if someone already syncs symlinks to/from Android in such a way…