James Gray
8/18/2006 11:56:00 PM
On Aug 18, 2006, at 5:49 PM, Hal Fulton wrote:
> Basically I want to talk securely to a machine that that knows ssh
> while spending as little time as possible porting my old code that
> uses ftp and telnet libs. (And spending as few neurons in the process
> as I can.)
I converted all the Ruby Quiz software from FTP to SFTP about six
months ago. It's really very close to the same thing. I couldn't
have spent more than two hours with the learning time and converting
all three of my worker scripts. Here's the general pattern:
require "net/sftp"
Net::SFTP.start("url", "username", "password") do |server|
begin
server.put_file("local_path", "server_path")
# possibly...
server.setstat("server_path", :permissions => 0644)
# ...
rescue
puts "Something went wrong: #{$!}"
end
end
__END__
Hope that helps.
James Edward Gray II