I want to check for the existence of a file on a remote server -
Current code:
FUNCTION CheckFiles(targetServer, prefix)
ON ERROR RESUME NEXT
Dim xmlhttp
fileURL = "<path omitted>"
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", fileURL, False
xmlhttp.send
If(Err.Number<>0) then
Response.Write "Could not connect to remote server"
else
Select Case Cint(xmlhttp.status)
Case 200, 202, 302
Set xmlhttp = Nothing
DoesFileExist = True
Case Else
Set xmlhttp = Nothing
DoesFileExist = False
End Select
end if
ON ERROR GOTO 0
End FUNCTION
After reading some more examples with a sample similar to this it's always used with a web URL (should have been obvious to me by the ServerXMLHTTP but anyways...
Is it possible to perform something like this but using the Windows file sharing method? For example:
"\\"+targetServer+"\c$\path1\path2\path3\"+prefix+"-filename.txt"