VBScript Question. Network Paths and FileExists

Started by
6 comments, last by Nibbles 20 years, 10 months ago
Hiya, Hopefully someone can shed some light on this issue for me because I just ran into a wall. Using VBScript i''m trying to check to see if a file exists on a remote computer on my network (ie: \\computer2\file.txt) So far I have:

<%

'' ...

strTemp = "\\computer2\testfile.doc"   '' this says false regardless of whether the file exists or not.
''strTemp = "c:\testfile.doc" '' this returns proper results.  however, this is not an option :(

Set FSO = Server.CreateObject("Scripting.FileSystemObject" )

If FSO.FileExists(strTemp) Then
  Response.Write strTemp & " - File Exists"
Else
  Response.Write strTemp & " - File Does Not Exist"
End If

Set FSO = Nothing

''...

%>

Hopefully that doesn''t look to garbled. I''ve tried many variations for strTemp but all with no luck. Thanks for any suggestions and help Scott "And the shadow fell upon the Land, and the World was riven stone from stone. The oceans fled, and the mountains were swallowed up, and the nations were scattered to the eight corners of the world. The moon was as blood, and the sun was as ashes. The seas boiled, and the living envied the dead."
Advertisement
Is file sharing enabled on the remote computer? If it is, then you simply create a network share on the remote computer, and on the local computer share it as some drive, say N: for example. Then you'd use N:\\testfile.doc to get access to it.


[edited by - Mastaba on June 2, 2003 3:34:17 PM]
.
You have a computer name in the UNC path and a file name but no share name.

\\computer\share\FIleName

--What are you nutz?I have nothing to say to your unevolved little brain. The more I say gives you more weapons to ask stupid questions.
still no luck any other ideas? i can copy/paste the exact path/filename i''m trying to test into my address bar and it finds the file fine... it''s just this FileExists doesn''t like me.

Thanks for the help so far.. i really appreciate this.


"And the shadow fell upon the Land, and the World was riven stone from stone. The oceans
fled, and the mountains were swallowed up, and the nations were scattered to the eight
corners of the world. The moon was as blood, and the sun was as ashes. The seas boiled,
and the living envied the dead."
okie,

I tried mapping a drive to my local computer, and tried to see if i could check to see if a file exists and it worked however, i tried mapping a drive to another computer on the network, copied the file to the share, and tried to see if the file exists and it didn''t work. I thought it might be a security type of issue, but i can access/modify the file so i''m not sure where/what to check/try next.


"And the shadow fell upon the Land, and the World was riven stone from stone. The oceans
fled, and the mountains were swallowed up, and the nations were scattered to the eight
corners of the world. The moon was as blood, and the sun was as ashes. The seas boiled,
and the living envied the dead."
From the looks of the comment tags, you''re trying to run this from within a webpage.

Are you trying to do it client-side or server-side?

Have you considered that maybe the security policy on the machine is preventing your webpage from accessing the file?

RomSteady - I play games for a living.
Michael Russell / QA Manager, Ritual EntertainmentI used to play SimCity on a 1:1 scale.
client. considered? yes, though was hoping i was wrong. seems that it''s pretty likely that the page cannot access it.

Thank you


"And the shadow fell upon the Land, and the World was riven stone from stone. The oceans
fled, and the mountains were swallowed up, and the nations were scattered to the eight
corners of the world. The moon was as blood, and the sun was as ashes. The seas boiled,
and the living envied the dead."
Try this
daerid@gmail.com

This topic is closed to new replies.

Advertisement