打印本文 打印本文 关闭窗口 关闭窗口
asp复制文件函数,asp移动文件函数
作者:武汉SEO闵涛  文章来源:敏韬网  点击数927  更新时间:2010/1/14 22:53:38  文章录入:mintao  责任编辑:mintao

以下是代码片段:
'-------------------复制文件--------
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

 使用如下:

 db="/Article/UploadFiles/200710/"&Title&""
TempSource= Server.MapPath(db)
 db1="/Article/PicFile/"&Title&""
'db1=Replace(db1,"200708/","")
TempEnd=Server.MapPath(db1)
Call CopyFiles(TempSource,TempEnd)
Response.Write TempSource
Response.Write "<br>"
Response.Write TempEnd

打印本文 打印本文 关闭窗口 关闭窗口