<html><body>删除一个文件的范例<br><br>
<%
Dim objFSO '声明一个名称为 objFSO 的变量以存放对象实例
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(Server.MapPath("\newfile.asp")) Then
objFSO.DeleteFile Server.MapPath("\newfile.asp"),True
Response.Write "已经成功地对文件"&Server.MapPath("\newfile.asp")&"进行了删除"
Else
Response.Write Server.MapPath("\newfile.asp")&"不存在,无法进行删除"
End If
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
%>
</body></html>
<html><body>删除一个文件的范例<br><br>
<%
Dim objFSO '声明一个名称为 objFSO 的变量以存放对象实例
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(Server.MapPath("\newfile.asp")) Then
str="已经成功地对文件"&Server.MapPath("\newfile.asp")&"进行了删除"
objFSO.DeleteFile Server.MapPath("\newfile.asp"),True
Else
str=Server.MapPath("\newfile.asp")&"不存在,无法进行删除"
End If
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
response.write str
%>
</body></html>