asp中 FSO複製文件

<%


Dim TempSource,TempEnd'必須用絕對路徑

rootPath=Request.ServerVariables("APPL_PHYSICAL_PATH")  '獲取當前程序絕對路徑
SourcePath=server.mappath("/images/dot1.gif")
DestinatePath="d:/yingshangenglish/images/upfile"
'response.write SourcePath
'response.write DestinatePath
Function CopyFiles(TempSource,TempEnd)
    Dim FSO
    Set FSO = Server.CreateObject("Scripting.FileSystemObject")
IF FSO.FileExists(TempEnd) then
       Response.Write "目標備份文件 <b>" & TempEnd & "</b> 已存在,請先刪除!"

       Set FSO=Nothing
       Exit Function
    End IF
    IF FSO.FileExists(TempSource) Then
    Else
       Response.Write "要複製的源數據庫文件 <b>"&TempSource&"</b> 不存在!"
       Set FSO=Nothing
       Exit Function
    End If
    FSO.CopyFile TempSource,TempEnd
    Response.Write "已經成功複製文件 <b>"&TempSource&"</b> 到 <b>"&TempEnd&"</b>"
    Set FSO = Nothing
End Function

Call CopyFiles(SourcePath,DestinatePath&"/new1110.gif")
 %> 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章