asp中 FSO复制文件

来源:互联网 发布:马可主演的网络剧 编辑:程序博客网 时间:2024/05/28 15:29

<%


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")
 %>