How to Transfer Files using SSH and Ruby
Matthew Bass has written a tutorial, published by InfoQ, called "Automating File Uploads with SSH and Ruby." It provides an in-depth look into building a small Ruby script that can backup files to a remote machine over SSH using the Net-SSH and Net-SFTP libraries. It goes into quite some depth, and provides source code for a recursive backup script. If you haven't had a dig into the Net-SSH and Net-SFTP libraries yet, it's worth a look to see how the basics work.