asp删除文件函数

来源:互联网 发布:电信网络拓扑图 编辑:程序博客网 时间:2024/06/05 16:52
'删除文件函数:
Sub DeleteFile(FileName)
    '首选判断要建立的文件夹是否已经存在
    Dim strTestFile, objFSO
    strTestFile = Server.Mappath(FileName)
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    ' 检查文件是否存在
    If objFSO.FileExists(strTestFile) Then
      objFSO.DeleteFile(strTestFile)
    Else
      response.write "<h1><font color=red>该文件夹不存在!</font></h1>"
    End If
    Set objFSO = Nothing
End Sub 
原创粉丝点击