ASP DeleteMethod


File 对象参考手册Complete File Object Reference

The Delete method deletes the specified file or folder.

Note:If the specified file or folder does not exist, an error occurs. The Delete method used for folders with content is no different from that used for folders without content. Regardless of content, the specified folder is deleted. The result of applying the Delete method to a File or Folder is identical to the operation performed using FileSystemObject.DeleteFile or FileSystemObject.DeleteFolder.

Syntax

FileObject.Delete[(force)]

FolderObject.Delete[(force)]

Parameters Description
force Optional. A Boolean value indicating whether read-only files or folders can be deleted. True indicates that read-only files/folders can be deleted; false indicates that files/folders cannot be deleted. The default is false.

Example for the File object

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
f.Delete
set f=nothing
set fs=nothing
%>

Example for the Folder object

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
fo.Delete
set fo=nothing
set fs=nothing
%>


File 对象参考手册Complete File Object Reference Other Extensions