关于我之前发布的question,我编写了以下脚本来加载特定文件:
#!/bin/perl
use strict;
use Net::FTP;
my $ftpOb = Net::FTP->new("X")
or die ("Could not connect to the FTP Server: $@");
print "Connected \n";
$ftpOb->login("A", "B")
or die ("Incorrect server credentials");
print "Logged in \n";
print " Current folder is: " . $ftpOb->pwd();
$ftpOb->cwd("root/Folder") or die ("Cannot connect to the folder on Server");
print "Transferred to folder \n";
$ftpOb->get("621418185-006249189002-5383.txt")
or die ("Error occured while fetching the file");
$ftpOb->quit;
但是,代码似乎无法更改工作目录,我得到以下输出:
Connected
Logged in
Cannot connect to the folder on Server at ./GetUploadFile.pl line 16.
Current folder is: /
有人可以帮我调试这个问题吗?
答案 0 :(得分:2)
在错误消息中包含$ftpOb->message()
(连接除外,其中$@
是正确的错误消息)。
还要做一个dir()并列出可用的文件/目录。