我正在尝试将文件还原到它的原始位置。登录FTP服务器后,如何将其放入某个目录。截至目前,它将进入根目录......
$f = Net::FTP->new($server, Debug => 0);
$f->login($username, $passwd) or &fail;
$msg = "".$f->message."";
$f->binary();
$f->put($newfile) or &fail;
&pass;
答案 0 :(得分:3)
首先尝试更改目录:
$f->cwd('/somedirectory')
or die "Cannot change working directory ", $ftp->message;
来自文档:
cwd ( [ DIR ] )
Attempt to change directory to the directory given in $dir. If
$dir is "..", the FTP "CDUP" command is used to attempt to move up
one directory. If no directory is given then an attempt is made to
change the directory to the root directory.