I don't know how to do that, but I suppose I could figure that out. There's no encryption on those files, though, if they are plain text...
Discussion
Sftp is encrypted. I use it to sync files on my phone from my home Synology nas with the FolderSync app.
I was thinking about using NextCloud for it, but I went with the simplest option for my needs, since I'm the only one using it. It's a fairly low level solution.
Oh! I use syncthing for a few folders to keep things current between my phone and laptop. If it's like that, then it's really useful.