- 論壇徽章:
- 0
|
再用 Net::SCP::Expect 從local 傳動(dòng)到 Remote 的時(shí)候,發(fā)現(xiàn)用通配符發(fā)送文件時(shí),程序沒(méi)法解析出通配符。
但是,從Remote 發(fā)送到 local 時(shí),就可以成功。
程序如下:
use strict;
use warnings;
use Net::SCP::Expect;
my $host = '192.168.0.1';
my $usre = 'root';
$passwd = '123456';
my $scpe = Net::SCP::Expect->new(host=>"$host",user=>"$user",password=>"$passwd");
$scpe->scp("/root/*.log","/root")
}
說(shuō)明: 我想把 local 的/root/*.log 所有文件,都傳送到 remote 的 /root 目錄去, 不成功,當(dāng)在源碼中開啟debug機(jī)制時(shí)。
報(bào)錯(cuò)信息如下:
/root/*.log: No such file or directory
scp exited with non-success state: 256 at ./t.pl line 30
google了一下,用"\"注釋掉*號(hào),或者用單引號(hào)引起*號(hào)。均無(wú)效。
$scpe->scp("/root/\*.log","/root")
$scpe->scp("/root/'*'.log","/root")
但是,從 remote 發(fā)送到 local 時(shí),用*號(hào)通配符時(shí),就可行。
$scpe->scp("$host:/root/*.log","/root")
還有一個(gè)疑問(wèn), 用 Net::SCP::Expect 模塊,可實(shí)現(xiàn)傳送一個(gè)整目錄嗎?
還有,各位大蝦,都喜歡用什么模塊來(lái)實(shí)現(xiàn)文件傳送的? 謝謝。。。 |
|