Question about System.IO File/Directory classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vince

    Question about System.IO File/Directory classes

    MSDN help says you can use a UNC path for any methods
    that accept a path, and I'm wondering if I can also
    substitute an IP address for the UNC....???

    Example:

    Using System.IO.File. Move()

    File.Move("\\\\ MyServer\\share \\dir\\myfile.t xt",
    "\\\\YourServer \\share\\dir\\m yfile.txt");

    Should I also be able to use IP address like this?:

    File.Move("http :192.168.1.1\\s hare\\dir\\myfi le.txt",
    "http:192.166.1 .3\\share\\dir\ \myfile.txt");

    thanks for your input...

    vince





  • Anthony Moore

    #2
    RE: Question about System.IO File/Directory classes

    No. Unfortunately the System.IO classes do not transparently handle http
    and other protocols that are supported by System.Net. You will have to
    write System.Net code to download the file first.

    Obviously it would be very useful for this to "just work", and it is a
    commonly requested feature. It has been under consideration for some time,
    although it is unfortunately a very difficult task to squash these two
    together.

    --------------------[color=blue]
    > Content-Class: urn:content-classes:message
    > From: "vince" <vlusardi@sdcer a.org>
    > Sender: "vince" <vlusardi@sdcer a.org>
    > Subject: Question about System.IO File/Directory classes
    > Date: Thu, 10 Jul 2003 11:41:19 -0700
    > Lines: 24
    > Message-ID: <00cb01c34712$d a199940$a401280 a@phx.gbl>
    > MIME-Version: 1.0
    > Content-Type: text/plain;
    > charset="iso-8859-1"
    > Content-Transfer-Encoding: 7bit
    > X-Newsreader: Microsoft CDO for Windows 2000
    > Thread-Index: AcNHEtoXYKdxIfW QTzu3rFLmLf1vuA ==
    > X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    > Newsgroups: microsoft.publi c.dotnet.genera l
    > Path: cpmsftngxa06.ph x.gbl
    > Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:100804
    > NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
    > X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    >
    > MSDN help says you can use a UNC path for any methods
    > that accept a path, and I'm wondering if I can also
    > substitute an IP address for the UNC....???
    >
    > Example:
    >
    > Using System.IO.File. Move()
    >
    > File.Move("\\\\ MyServer\\share \\dir\\myfile.t xt",
    > "\\\\YourServer \\share\\dir\\m yfile.txt");
    >
    > Should I also be able to use IP address like this?:
    >
    > File.Move("http :192.168.1.1\\s hare\\dir\\myfi le.txt",
    > "http:192.166.1 .3\\share\\dir\ \myfile.txt");
    >
    > thanks for your input...
    >
    > vince
    >
    >
    >
    >
    >
    >[/color]


    --

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at
    Use these online forms to report copyright and trademark infringement to Microsoft Legal. Infringement notices must comply with the Digital Millennium Copyright Act.


    Note: For the benefit of the community-at-large, all responses to this
    message are best directed to the newsgroup/thread from which they
    originated.

    Comment

    • Scott

      #3
      Re: Question about System.IO File/Directory classes

      I just wanted to add to the initial reply.

      I often have questions like this, and I find the Microsoft Shared
      Source an invaluable tool. Somewhere in the Path (or File) class it
      has something like :

      if(path.StartsW ith(http))....

      The shared source can be found at (for downloading):




      Scott


      Comment

      Working...