Skip to content
Related Articles

Related Articles

Improve Article
ASP Delete Method
  • Last Updated : 31 Mar, 2021

The ASP File.Delete Method is used to delete a particular file or folder from a system. 

Syntax 

FileObject.Delete[(force)]
FileObject.Delete[(force)]

Parameter Values:

  • force: It is an optional attribute. It contains a Boolean value which indicates that whether a read-only file will be deleted or not.  It set to true means that the read-only file will be deleted. False represents that the file will not be deleted.

Example 1: Below code illustrates the ASP File.Delete Method

ASP






<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("d:\GFG.txt")
f.Delete
response.write("GFG.txt file is deleted")
set f=nothing
set fs=nothing
%>

Output:

GFG.txt file is deleted

Example-2: Below code demonstrates the ASP folder.delete Method.

ASP




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

Output:

GFG Folder is deleted
My Personal Notes arrow_drop_up
Recommended Articles
Page :