#### Archived

This topic is now archived and is closed to further replies.

# VBScript Question. Network Paths and FileExists

This topic is 5312 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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."

##### Share on other sites
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]

##### Share on other sites
You have a computer name in the UNC path and a file name but no share name.

\\computer\share\FIleName

##### Share on other sites
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."

##### Share on other sites
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."

##### Share on other sites
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.

##### Share on other sites
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."