A quick question, but which I don't believe has been asked here or at SO.

Does Mathematica have a simple way to just download a file from the web? i.e. if I have a list of PDF links (~ 2,000), can I use Mathematica to quickly take them and save them to my system. The obvious way that I've used in the past is to Import[] the data, but since we're talking large-ish PDFs I wonder if there's a way to skip that step.

I have used wget for this sort of thing in the past, but just seeing if there's an easy way to do it within Mathematica. The 'Web Operations' section of the documentation does not seem to have any obvious reference to this. If not, I will obviously just use the 'proper' tool.


4 Answers 4


How about a version of:

path = FetchURL[
get_obj=ifp2_cut.mesh.gz&acces=ifp2_cut", "ifp2_cut.mesh.gz"];
  • 1
    $\begingroup$ This works great. I've never used this Package, so will read up on it. $\endgroup$ Commented Feb 2, 2012 at 18:03

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:


Which seem to work perfectly.

  • 4
    $\begingroup$ This is the one I would recommend with V9 and beyond. The FetchURL function above now internally uses URLFetch and similar functions from the new HTTPClient` package. It supports proxies and lots of options. $\endgroup$
    – Joel Klein
    Commented Jan 16, 2013 at 16:49
  • $\begingroup$ for MMA v11+ see navigaid answer below $\endgroup$
    – glS
    Commented Mar 5, 2018 at 17:43

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".


You can run wget from within Mathematica. For example if you have your URLs in a text file then just run this in a Mathematica input cell (where on my Mac wget is located in sw/bin):

Run["/sw/bin/wget --no-check-certificate --user-agent=" " -x -i /Users/mypath/urls.txt"]

This is actual code -- with the path changed -- that I run to download information from the Australian stock exchange so I can verify that wget can be run from within Mathematica this way. If you are already set up for using wget then as you probably know it offers advantages over built in Mathematica functions in so far as you can download from sites that require login and do many other useful things.

  • $\begingroup$ Fantastic! I've used wget before,esp. when I need to use cookies and such, so this is a great addition to my toolkit. Thanks for this. $\endgroup$ Commented Feb 2, 2012 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.