Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

closed as off-topic by Jenny D, Chris S May 2 at 13:05

  • This question does not appear to be about professional server, networking, or related infrastructure administration within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This question appears to be off-topic because it is about a typical User use-case, not directly related to System Administration. Questions like this should be asked on Unix & Linux. This question is too old to migrate there. –  Chris S May 2 at 13:05

3 Answers 3

up vote 8 down vote accepted
curl http://google.com > /path/to/dir/index.html
share|improve this answer

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.

share|improve this answer

CORRECTION:

You can use

-o, --output FILE Write output to instead of stdout

curl --url https://google.com --output /any/file-location

share|improve this answer
    
This doesn't answer the question. –  Andrew Schulman May 2 at 10:51