Linux – How to mention the prefix directory path in CURL command

curlftplinuxsftpunix

I am new to Linux, i want to write the perl script to download the files from FTP sites but here i want to use curl command to download the files. which is working fine in wget command but not working with curl command.

The below coommand is downloading the file from SFTP servers, Here i have mentioned the SFTP username/password mentioned in the wgetrc_proxy file and mentioned the directory path where to download the DATA.zip(/hom1/sara/) in the my linux box.

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

I tried the same scenario using CURL, but which is not working.

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

wgetrc_proxy contains below things.

-sh-3.00$ cat wgetrc_proxy
netrc = off

login=aaaa
passwd=xxxx

dot_style=mega
timeout=180

What mistake i have done here, else missed any environment configuration. Please help me out to resolve this issue.

Best Answer

curl doesn't support a wgetrc file or the same command line options as wget. Use man curl to get the complete list of available options.

This should do:

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