test "file exists" on remote computer?

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

    #1

    test "file exists" on remote computer?

    I successfully use "My.Computer.Ne twork.DownloadF ile", including the
    authentication data, but I would appreciate learning how to first test
    whether the file exists on the remote computer. Thanks.
    - Pete

  • Charlie Brown

    #2
    Re: test "file exists" on remote computer?

    'Create a string for the file path
    Dim strPath As String = "C:\MyDirectory \MyFile.txt"
    If System.IO.File. Exists(strPath) Then
    'Your Code here
    End If

    you can also use UNC paths as well
    "\\computername \MyDirectory\My file.txt"

    Pete wrote:
    I successfully use "My.Computer.Ne twork.DownloadF ile", including the
    authentication data, but I would appreciate learning how to first test
    whether the file exists on the remote computer. Thanks.
    - Pete

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: test "file exists" on remote computer?

      Pete,

      Have a look at the webrequest class

      http://msdn.microsoft.com/library/de...classtopic.asp

      I hope this helps,

      Cor

      "Pete" <signell@msu.ed uschreef in bericht
      news:1159911063 .333381.136660@ m7g2000cwm.goog legroups.com...
      >I successfully use "My.Computer.Ne twork.DownloadF ile", including the
      authentication data, but I would appreciate learning how to first test
      whether the file exists on the remote computer. Thanks.
      - Pete
      >

      Comment

      • Pete

        #4
        Re: test &quot;file exists&quot; on remote computer?

        Thanks, but could you please tell me how the username and password get
        transmitted using "System.IO.File .Exists". They were just args of
        "My.Computer.Ne twork.DownloadF ile". - Pete

        Charlie Brown wrote:
        'Create a string for the file path
        Dim strPath As String = "C:\MyDirectory \MyFile.txt"
        If System.IO.File. Exists(strPath) Then
        'Your Code here
        End If
        >
        you can also use UNC paths as well
        "\\computername \MyDirectory\My file.txt"
        >
        Pete wrote:
        I successfully use "My.Computer.Ne twork.DownloadF ile", including the
        authentication data, but I would appreciate learning how to first test
        whether the file exists on the remote computer. Thanks.
        - Pete

        Comment

        Working...