Home All Groups Group Topic Archive Search About

test "file exists" on remote computer?

Author
3 Oct 2006 9:31 PM
Pete
I successfully use "My.Computer.Network.DownloadFile", including the
authentication data, but I would appreciate learning how to first test
whether the file exists on the remote computer.  Thanks.
- Pete

Author
4 Oct 2006 3:08 AM
Charlie Brown
'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\Myfile.txt"

Pete wrote:
Show quoteHide quote
> I successfully use "My.Computer.Network.DownloadFile", including the
> authentication data, but I would appreciate learning how to first test
> whether the file exists on the remote computer.  Thanks.
> - Pete
Author
5 Oct 2006 11:26 AM
Pete
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.Network.DownloadFile".  - Pete

Charlie Brown wrote:
Show quoteHide quote
> '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\Myfile.txt"
>
> Pete wrote:
> > I successfully use "My.Computer.Network.DownloadFile", including the
> > authentication data, but I would appreciate learning how to first test
> > whether the file exists on the remote computer.  Thanks.
> > - Pete
Author
4 Oct 2006 4:07 AM
Cor Ligthert [MVP]
Pete,

Have a look at the webrequest class

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetwebrequestclasstopic.asp

I hope this helps,

Cor

Show quoteHide quote
"Pete" <sign***@msu.edu> schreef in bericht
news:1159911063.333381.136660@m7g2000cwm.googlegroups.com...
>I successfully use "My.Computer.Network.DownloadFile", including the
> authentication data, but I would appreciate learning how to first test
> whether the file exists on the remote computer.  Thanks.
> - Pete
>