Delete Method

 

Description

 

Deletes a specified folder.

 

PowerBASIC Syntax

 

METHOD Delete (BYVAL bForce AS INTEGER)

 

Arguments

 

bForce

Boolean value that is True if folders with the read-only attribute set are to be deleted; False (default) if they are not.

 

Remarks

 

An error occurs if the specified folder does not exist.

 

The results of the Delete method on a Folder are identical to operations performed using FileSystemObject.DeleteFolder.

 

The Delete method does not distinguish between folders that have contents and those that do not. The specified folder is deleted regardless of whether or not it has contents.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

DIM pFolder AS IFolder

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Get a reference to the IFolder interface

pFolder = fso.GetFolder(UCODE$("C:\MyFolder"))

' Delete the folder

pFolder.Delete %VARIANT_TRUE

IF OBJRESULT = %S_OK THEN

  MSGBOX "Folder deleted"

ELSE

  MSGBOX "Error &H" & HEX$(OBJRESULT) & " deleting the folder"

END IF

 

Valid XHTML 1.0 Transitional