ASP Delete Method
Complete Folder object reference manual
The Delete method deletes a specified file or folder.
**Note:** An error occurs if the specified file or folder does not exist. The Delete method works the same way on folders with and without content; regardless of content, the specified folder is deleted. Applying the Delete method to a File or Folder produces exactly the same result as 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 read-only files/folders can be deleted; false indicates they cannot. 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
%>
Complete Folder object reference manual