Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does curl put downloads?

Tags:

curl

windows

Original Question

We are downloading several large files with cURL.

curl -O -L -k "https://www.modern.ie/vmdownload?browserOS=IE8-Win7&parts=4&platform=Windows&virtPlatform=vpc&filename=VMBuild_20141027/VPC/IE8/Windows/IE8.Win7.For.Windows.VPC.zip{.001,.002,.003,.004}"

Where do the downloads land?

Edit 1 Follow-up Question

Our command prompt is at C:\WINDOWS\system32\cmd.exe. When I look through that directory, I don't find the downloaded file, which I would expect to be IE8.Win7.For.Windows.VPC.zip.001. This is the cURL output.

[1/4]: https://the-long-url/IE8.Win7.For.Windows.VPC.zip.001 
    --> IE8.Win7.For.Windows.VPC.zip.001 
    --_curl_--https://the-long-url/IE8.Win7.For.Windows.VPC.zip.001

Palu said, "the download will go to the current working directory for when this was executed." Why isn't it there?

Edit 2 Follow-up Answer

Why isn't it there? Because although we were running C:\WINDOWS\system32\cmd.exe, we were running it from C:\Users\shaun.luttin.

like image 471
Shaun Luttin Avatar asked Apr 21 '15 17:04

Shaun Luttin


1 Answers

In this case, the download will go to the current working directory for when this was executed.

  • If you used BASH or another command prompt, look at the path it is executing from.
  • If you are executing from an application you created, try the directory where the binary is executing from.
  • If your command was executed on a remote machine, don't forget to look in the respective places on that machine instead of your own.

From The curl Man Page

-o, --output <file>

Write output to instead of stdout. If you are using {} or [] to fetch multiple documents, you can use '#' followed by a number in the specifier. That variable will be replaced with the current string for the URL being fetched. Like in:

curl http://{one,two}.site.com -o "file_#1.txt"

or use several variables like:

curl http://{site,host}.host[1-5].com -o "#1_#2"

You may use this option as many times as the number of URLs you have.

See also the --create-dirs option to create the local directories dynamically. Specifying the output as '-' (a single dash) will force the output to be done to stdout.

-O, --remote-name

Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.)

The remote file name to use for saving is extracted from the given URL, nothing else.

Consequentially, the file will be saved in the current working directory. If you want the file saved in a different directory, make sure you change current working directory before you invoke curl with the -O, --remote-name flag!

There is no URL decoding done on the file name. If it has %20 or other URL encoded parts of the name, they will end up as-is as file name.

You may use this option as many times as the number of URLs you have.

like image 137
Palu Macil Avatar answered Nov 30 '22 20:11

Palu Macil