如何在 CURL 命令中提及前缀目录路径

如何在 CURL 命令中提及前缀目录路径

我是 Linux 新手,我想编写 perl 脚本从 FTP 站点下载文件,但是这里我想使用 curl 命令来下载文件。使用 wget 命令可以正常工作,但使用 curl 命令则不行。

以下命令是从 SFTP 服务器下载文件,这里我提到了 wgetrc_proxy 文件中提到的 SFTP 用户名/密码,并提到了在我的 Linux 机器中下载 DATA.zip(/hom1/sara/)的目录路径。

WGETRC=/hom1/sara/wgetrc_proxy wget --directory-prefix=/hom1/sara/ ftp://67.125.134.122/out_files/DATA.ZIP

我尝试使用 CURL 来实现同样的效果,但是没有效果。

WGETRC=/hom1/sara/wgetrc_proxy curl --directory-prefix=/hom1/sara/ ftp://67.125.134.122/out_files/DATA.ZIP

wgetrc_proxy 包含以下内容。

-sh-3.00$ cat wgetrc_proxy
netrc = off

login=aaaa
passwd=xxxx

dot_style=mega
timeout=180

我在这里犯了什么错误,或者错过了任何环境配置。请帮我解决这个问题。

答案1

curl不支持wgetrc文件或与 相同的命令行选项wget。使用man curl获取可用选项的完整列表。

这应该可以做到:

cd /hom1/sara/ && curl --max-time 180 --proxy aaaa:xxxx@$http_proxy ftp://67.125.134.122/out_files/DATA.ZIP

相关内容