asp中FSO复制文件代码

复制代码 代码如下:

  TempSource,TempEnd必须用绝对路径

  rootPath=Request.ServerVariables("APPL_PHYSICAL_PATH")  ‘获取当前程序绝对路径

  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