9行代码实现scp 2015/08/15 16298 #gem install net-ssh #gem install net-sftp require 'rubygems' require 'net/ssh' require 'net/sftp' Net::SSH.start('server', 'username', 'password') do |ssh| ssh.sftp.connect do |sftp| Dir.foreach('.') do |file| puts file end end end