ASP Delete Method
Definition and Usage
The Delete method can delete 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 and folders without content is the same. Whether there is content or not, the specified folder is deleted. The result of applying the Delete method to File or Folder is exactly the same as the operation performed by FileSystemObject.DeleteFile or FileSystemObject.DeleteFolder.
Syntax:
FileObject.Delete[(force)] FolderObject.Delete[(force)]
Parameter | 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 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 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 %>