Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'net/sftp'
- Net::SFTP.start('site', 'username', :password => 'pass') do |sftp|
- local_dir = "/home/user/put_files_here/"
- remote_dir = "/home/user/get_from_here/"
- sftp.dir.foreach(remote_dir) do |entry|
- local_file = "#{local_dir}#{entry.name}"
- remote_file = "#{remote_dir}#{entry.name}"
- sftp.download!(remote_file, local_file)
- end
- Errors:
- /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/operations/download.rb:307:in `on_open': open /Ecomm/Content_Feeds/US_Content_Feed/CWUS-RelNotes-INC-Mon-Aug-04-15-24-15-PST-2008-A-MV-90.xml.gz: failure (4) (RuntimeError)
- from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `to_proc'
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/request.rb:87:in `call'
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/request.rb:87:in `respond_to'
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.rb:947:in `dispatch_request'
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.rb:910:in `when_channel_polled'
- from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `to_proc'
- from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh/connection/channel.rb:311:in `call'
- from /usr/lib/ruby/gems/1.8/gems/net-ssh-2.0.4/lib/net/ssh/connection/channel.rb:311:in `process'
- ... 28 levels...
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.rb:801:in `loop'
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp/session.rb:786:in `connect!'
- from /usr/lib/ruby/gems/1.8/gems/net-sftp-2.0.1/lib/net/sftp.rb:32:in `start'
- from ./medianet.rb:6
- from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `to_proc'
Add Comment
Please, Sign In to add comment