From: Rui on
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?

Thanks

From: Albert Retey on
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