Thursday, August 25, 2011
download files from web via the OS x command line
curl -O http://example.com/test.pdf
You might want to include a few extra bits in that post. First, always include the -L (or –location) switch, since that will allow curl to follow any redirects (if the file gets moved, but there is a redirect for it). Also, if the URL’s file part (the section after the last slash) is not pretty, you can give a name for the downloaded file by using a lower-case -o (instead of -O), followed by a space and the name in quotes. Also, always put the URL in single-quotes – ampersands and a few other characters will break on the command line if they aren’t in quotes. Here’s an example of those ideas combined:
curl -L -o ‘myfile.dmg’ ‘http://www.somewebsite.com/files/getdmg?id=24‘
Reference:
http://osxdaily.com/2007/05/11/download-files-from-the-web-via-the-os-x-command-line/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment