Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Saving files from the web

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111307] Re: Saving files from the web
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Tue, 27 Jul 2010 04:16:32 -0400 (EDT)
  • References: <i2btas$bao$1@smc.vnet.net>

Hi,

> I want to save some files from the web to the disk. I already
> generated the list of strings with the urls of the files I want to
> get, urlList, and I want them to keep the same names under the
> directory stored in the variable "dir". But my difficulty is in
> getting a file from the web and saving it to disk without Mathematica
> interpreting anything about the format. FileCopy doesn't seem to work.
> 
> Files are in zip, doc and pdf formats but I'm looking for a format-
> independent way. Should be easy, just binary import-export, but it's
> giving me a hard time.
> 
> Any easy way to tell Mathematica to do this?

You can use a second or third argument to Import and Export. I think
this should work (I tested it with a pdf file from the web):

Export[filename,Import[url,"Binary"],"Binary"]

I'm not sure whether this code and using mathematica in general is the
most effective way to solve this kind of problems, though...

hth,

albert


  • Prev by Date: Re: Writing to same file from several kernels?
  • Next by Date: Re: NDSolve - how to bypass safety chceck?
  • Previous by thread: Saving files from the web
  • Next by thread: Big Memory Needed Again