在经典 ASP 中检查远程服务器上的文件

问题描述

我想检查远程服务器上的文件是否存在 -

当前代码

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

在阅读了一些与此类似的示例的更多示例后,它始终与 Web URL 一起使用(ServerXMLHTTP 对我来说应该很明显,但无论如何...

是否可以执行类似的操作但使用 Windows 文件共享方法?例如:

"\\"+targetServer+"\c$\path1\path2\path3\"+prefix+"-filename.txt"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)