Open In App

ASP DeleteFolder Method

Last Updated : 23 Feb, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The ASP DeleteFolder Method is used to delete one or more folders from the server. It returns an error if we want to delete a non-existing folder.  

Syntax:

FileSystemObject.DeleteFolder(foldername[,force])

Parameter Values:

  • foldername: It specifies the name of the folder which you want to delete.
  • force: It is an optional attribute. It contains a Boolean value which indicates that whether a read-only folder will be deleted or not.  It set to true means that the read-only folder will be deleted. False represents that the folder will not be deleted.

Example: Below example demonstrates the DeleteFolder Method.  

ASP




<%
dim gfg
set gfg=Server.CreateObject("Scripting.FileSystemObject")
if gfg.FolderExists("C:\Folder2\B") then
 gfg.DeleteFolder("C:\Folder2\B")
 response.write("Folder is Deleted")
end if
set gfg=nothing
%>


Output:

Folder is Deleted

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads