Downloading files without using Import

How about a version of:

Needs["Utilities`URLTools`"];
path = FetchURL[
   "http://www-roc.inria.fr/gamma/download/counter.php?dir=MECHANICAL//&\
get_obj=ifp2_cut.mesh.gz&acces=ifp2_cut", "ifp2_cut.mesh.gz"];

As a quick update to this, Mathematica 9 added some additional functionality that I have been putting to use - it seems to work very well if you do text analysis, which I do.

Documentation for the new commands URLSave, URLFetch, and the really useful URLSaveAsynchronous are here. For example, I've been running commands like this:

URLSave["http://activehistory.ca","/users/MYPATH/activehistory.txt"];

Which seem to work perfectly.


As an update to this question, Mathematica 11.0 introduces a new function URLDownload.

To download a single file, use URLDownload[url,filename]
To download multiple files, try Thread[URLDownload[{url1,url2,…},{filename1,filename2,…}]

Note that the file name part is optional: URLDownload[url] and URLDownload[{url1,url2,…}] are okay. In that case, your file(s) will be randomly named and saved by default to your system temp folder, like "/tmp/64b4ece0-4e3e-417e-9077-567a26c2c9d1.tmp".

Tags:

Programming