Add a comment. Active Oldest Votes. The solution is to use -O -J -O, --remote-name Write output to a file named as the remote file -J, --remote-header-name Use the header-provided filename So Yevgeny Simkin Yevgeny Simkin You can write -OJ. As per 7. Solely --remote-name is sufficient. You can use the -o option can you?
Pay Attention! Well, you should pay attention too. Its a small "o", and it has the ability let user define file name. So how would I combine the two, and choose where the file gets downloaded, but preserving the name from the server?
The Overflow Blog. Write for DigitalOcean You get paid, we donate to tech non-profits. It supports many protocols and tends to be installed by default on many Unix-like operating systems.
Because of its general availability, it is a great choice for when you need to download a file to your local system, especially in a server environment. Downloading files off of the Internet can be dangerous, so be sure you are downloading from reputable sources. Out of the box, without any command-line arguments, the curl command will fetch a file and display its contents to the standard output.
Fetching a file and display its contents is all well and good, but what if you want to actually save the file to your system? You can check on things with the cat command:. Execute the following command to download the remote robots.
Now use the cat command to display the contents of do-bots. If you happened to try to fetch the robots. You can verify this by using the -I flag, which displays the request headers rather than the contents of the file:. To see more examples, you can read the article How to use a proxy with cURL. If you do not want cURL to show the progress meter or error messages, you can use the -s or --silent option:. Get feral when you answer to the greatest interview in history Share your philosophy.
Using cURL to retrieve the output of a file only takes a few more characters. Saving a file with a remote file name can save the output to a local file in the current working directory. Using the output redirection operator in Linux, you can use the output append operator to write the output into a specific file. If you want to download multiple files with a single command, you have to add the sizeof-r to the cURL.
0コメント