I also want locally deleted files to be deleted on the server.
Sometimes I even move files around (I believe in directory structure) and again, git deals with this perfectly. If it werenβt for the lossless-to-lossy caveat.
It would be perfect if my script could recognize that just like git does, instead of deleting and reuploading the same file to a different location.
If you were to use Git, deleted files get deleted in the working copy, but not in history. It's still there, taking up disk space, although no transmission.
I'd look at existing backup and file sync solutions. They may have what you want.
For an implementation, I would work with an index. If you store paths + file size + content checksum you can match files under different paths. If you compare local index and remote you could identify file moves and do the move on the remote site too.