Delete a Folder in VB Script

In VB Script, a folder can be deleted using the "DeleteFolder" method of the File System Object. Following is the syntax of DeleteFolder function

DeleteFolder "Folder Name" , Force

The argument "folder name" is the name of the folder to be deleted. 

The argument Force is a boolean value. If False is given, then if the folder contains read-only or system files or folders, then an error will be generated. If True is given, the folder will be deleted even if it contains read-only or system files and folders. The default value is False.

Following is a vbscript example to delete a folder

Set FS = CreateObject("Scripting.FileSystemObject")

FS.DeleteFolder "C:\Folder1",True
Powered by Bullraider.com