ASP DeleteMethod


Folder 对象参考手册Complete Folder Object Reference Manual

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 whether it has content, the specified folder is deleted. Applying the Delete method to a File or Folder produces exactly the same result as performing the operation 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 they 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
%>


Folder 对象参考手册Complete Folder Object Reference Manual Other Extensions