I know I can use the following 2 commands to download a file:
curl -O example.com/file.zip wget example.com/file.zip
But I want them to go into a specific directory. So I can do the following:
curl -o mydir/file.zip example.com/file.zip wget -O mydir/file.zip example.com/file.zip
Is there a way to not have to specify the filename? Something like this:
curl -dir mydir example.com/file.zip
Introduction : cURL is both a command line utility and library. One can use curl to download file or transfer of data/file using many different protocols such as HTTP, HTTPS, FTP, SFTP and more. The curl command line utility lets you fetch a given URL or file from the bash shell.
Differences Between wget and cURLWget is a simple transfer utility, while curl offers so much more. Curl provides the libcurl library, which can be expanded into GUI applications. Wget, on the other hand, is a simple command-line utility. Wget supports fewer protocols compared to cURL.
To download multiple files at the same time, use –O followed by the URL to the file that you wish to download. If you curl without any options except for the URL, the content of the URL (whether it's a webpage, or a binary file, such as an image or a zip file) will be printed out to screen.
The following line will download all the files to a directory mentioned by you.
wget -P /home/test www.xyz.com
Here the files will be downloaded to /home/test
directory
I know this is an old question but it is possible to do what you ask with curl
rm directory/somefile.zip rmdir directory mkdir directory curl --http1.1 http://example.com/somefile.zip --output directory/somefile.zip
first off if this was scripted you would need to make sure the file if it already exist is deleted then delete the directory then curl the download otherwise curl will fail with a file and directory already exist error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With