This is a steaming pile of SFTP. Why not use rsync or wrap it if you must?

For anyone who's interested in proper bidirectional sync check out Mutagen.[0]

[0]: https://mutagen.io/documentation/synchronization/