METHOD:  FileSystemObject.DeleteFolder

Implemented in version 2.0
object.DeleteFolder folder [, force]

This method is used to delete a specified folder or folders (using wildcards), including all of its subfolders and files. The optional force parameter returns a Boolean value - True allows folders with read-only attributes to be deleted, while False (default) does not.

Note that an error also occurs if you try to delete a folder that doesn't exist.

dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists("c:\DevGuru\website\") Then 
   filesys.DeleteFolder "c:\DevGuru\website"
   Response.Write("Folder deleted")
End If

"Folder deleted"

Copyright 1999-2004 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information