From: Jamis Buck Date: 2004-07-27T21:41:17+09:00 Subject: Re: Net::SSH::SFTP::Simple fails to get file hackerotaku wrote: > greetings to all > following code fails to retrieve file from server > the script completes with no errors produced > > ----------------------------------- > > #!/usr/local/bin/ruby > > require 'net/ssh' > require 'net/ssh/sftp/attrs' > require 'net/ssh/sftp/constants' > require 'net/ssh/sftp/session' > require 'net/ssh/transport/buffer' > require 'net/ssh/sftp/simple' > > Net::SSH::SFTP::Simple.new( 'www.fobar.com', 'foo', 'pass1234' ) do > |sftp| > status, files = sftp.list_dir( "/backups" ) > status, body = sftp.get( "/foo/foo.tar.bz2" ) > end How are you testing to see if no file is retrieved? The "get" method doesn't store a file on the local host -- it only grabs the contents of the file and returns it as "body". If you want the file copied from the remote host and then stored on the local host, you should either explicitly open the local file and write to it, _or_ you can use the "get_file" method. Let me know if that works for you. More work remains to be done with the SFTP protocol in Net::SSH, but the existing features work okay for me... -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis "I use octal until I get to 8, and then I switch to decimal."