2012-07-03 79 views
2

我想恢复文件到它的原始位置。我登录到FTP服务器后,如何将它放到某个目录中。截至目前将要到根目录...NET :: FTP放在perl命令

$f = Net::FTP->new($server, Debug => 0); 
    $f->login($username, $passwd) or &fail; 
    $msg = "".$f->message.""; 
    $f->binary(); 
    $f->put($newfile) or &fail; 
    &pass; 

回答

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.