我想从远程主机/root/files/*.log
所有文件复制到我的当前目录 - ./files1/
如何使用Ruby Net :: SSH.start传输多个文件?
require 'rubygems'
require 'net/ssh'
require 'net/scp'
Net::SSH.start(scp_hostname, scp_username, :keys => scp_keys, :timeout => 360) do |ssh|
ssh.scp.download!('/root/files/*.log', './files1/')
ssh.exec!(..)
ssh.exec!(..)
end
我有一个例外:
caught exception SCP did not finish successfully (1): scp: /root/files/*.log: No such file or directory
但它工作时,我复制一个特定的文件
ssh.scp.download!('/root/files/myfile.log', './files1/')
任何人都可以帮忙吗?
谢谢!
的感谢!我感谢你的回答!我喜欢你的诀窍:) – Berlin