我正在使用 System.IO.File.Copy 将文件从服务器 A 复制到服务器 B。当文件存在时,这很好接受我收到错误“文件已存在”。我尝试使用 if file.exsist 来捕获它,但什么也没有。
这是我的代码。
'Save files to disk
FileUpload1.SaveAs(Server.MapPath("../pdf/audits/" & FileName))
'Local Server
Dim localPath As String = "\\server01\folder1$\pdf\audits\"
'Remote Server
Dim remotePath As String = "\\server02\folder2$\pdf\audits\"
System.IO.File.Copy(localPath + FileName, remotePath + FileName)
我错过了什么?