gpt4 book ai didi

perl - NET::FTP put 命令在 perl 中

转载 作者:行者123 更新时间:2023-12-04 05:40:34 24 4
gpt4 key购买 nike

我正在尝试将文件还原到其原始位置。登录到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;

最佳答案

首先尝试更改目录:

$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.

关于perl - NET::FTP put 命令在 perl 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11310922/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com