how do I get curl to save a file to a specified directory? [closed]
I'm trying to get curl, using a script, to download a file and save it to a certain directory. I got it to download but I dont know how to get it to a certain directory from a script. It usually just saves it to the current working directory.
curl http://google.com > /path/to/dir/index.html
CORRECTION:
You can use
-o, --output FILE Write output to instead of stdout
curl --url https://google.com --output /any/file-location
Let curl and the shell each do what they do well:
(cd TARGET_DIRECTORY && curl ...)
Also there may be things that interest you in the description of the -o
option in the manual.