Re: Need script to download file at known address

From: phansen (peter_at_engcorp.com)
Date: 09/17/04


Date: Fri, 17 Sep 2004 08:05:15 -0400

Jeff Shannon wrote:
> Radioactive Man wrote:
>> Are there any variants of the "open" commmand that
>> allow location (drive and directory) of the file to be specified as
>> well, for example, if I wanted to save the file as
>> "D:\binaries\trash.gif" instead of the default location?
>
> As a matter of fact, the standard open() will handle that just fine --
> it accepts a pathname, rather than just a filename, so you can feed it
> an absolute path like your example or a relative path ...

But note that the directories have to exist already. If they don't,
you need to use something like os.makedirs() to get 'em.

-Peter



Relevant Pages

  • Re: lock on filename for XmlDocument.Save?
    ... sometimes absolute path and sometimes relative path. ... XmlDocument.Save with a filename attempts to open the file in Create mode for Writing with only Read sharing. ... if you don't really care that the second simultaneous Save is going to destroy the data from the first Save, you could just do a lock the XmlDocument.Save function call, which will enforce only one save at a time, or you could do a bit more complicated logic if you do care that you are overwriting an existing file, which will happen once the first Savecompletes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: absolute path to relative path conversion
    ... you give as you are effectively just after the filename: ... You could walk from you absolute path to the root of your drive and then ... walk down the path to your file, building the relative path as you go along. ... > Sorry for being so vague Rob ...
    (microsoft.public.dotnet.languages.csharp)
  • lock on filename for XmlDocument.Save?
    ... I'm calling XmlDocument.Save with a filename that often varies. ... sometimes absolute path and sometimes relative path. ... get a re-entrant save to the same filename, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Find out really (!) the path / getParent() not working
    ... Now if you want to get absolute path from relative path you can do ... fileName = new File; ... String path = fileName.getParent; ...
    (comp.lang.java.programmer)
  • Re: How does Require deal with multiple files of the same name in
    ... Jos van de Ven wrote: ... If a relative path is specified, there is at least one file in the ... Perhaps the same behaviour should take place when an absolute path is specified. ... If the variable is set to re-load then the first matching file ...
    (comp.lang.forth)