Monday, November 4, 2013

curl - GET single file

Curl is simple yet powerful tool for creating HTTP and FTP requests of all kind. I have permanent problem with simple getting file with curl and storing in to file system. This little post should remember it to me. Basically works like this:
curl -v --location --max-redirs 10 \
 --output install_1.3.0.sql \
 http://somesite.com/somefile.sql
One trick is to use --location which tell to curl to follow redirects until number of redirect reach value specified in --max-redirs. Second trick is to specify output file in --output. When output file is not specified retrieved data are send to console (STDOUT).

No comments:

Post a Comment