'================================================
' 删除指定的文件函数-http://www.bawn.cn
'调用方法:
'FilePath = "C:\a\b\c\d.gif"
'If AutoDelFile(FolderPath) Then
' Response.Write "删除文件成功"
'Else
' Response.Write "删除文件失败"
'End If
'================================================
Function DelFile(strPath)' As Boolean
On Error Resume Next
Dim oFSO
If InStr(strPath, "\") <=0 Or InStr(strPath, ":") <= 0 Then
DelFile = False
Exit Function
End If
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
If Not(oFSO.FileExists(strPath)) Then
DelFile = True
Exit Function
End if
oFSO.DeleteFile(strPath)
Set oFSO = Nothing
If Err = 0 Then
DelFile = True
Else
DelFile = False
End If
End Function
自己搞的一个小函数.希望你能用得上!