Is there a way to specify a specific file name when saving a file via cURL?

I am pulling files using curl in a Mac OS X terminal and want to give them different names. Is there a way to specify a name, for example, the "save as" function when using curl?

+89
terminal curl macos
Mar 16 2018-12-12T00:
source share
2 answers

Use the -o option or redirect shell output to the selection file with > .

 curl -o /path/to/local/file http://url.com curl http://url.com > /path/to/local/file 

If you want to keep the original file name from a remote server, use the -o option.

 curl -O http://url.com/file.html 

Saves output from a remote location in the current directory as file.html.

+160
Mar 16 2018-12-12T00:
source share

curl -o <name> <url> seems to do the trick.

TIP. You can also try using man curl ...

+10
Mar 16 2018-12-12T00:
source share



All Articles