DeleteFolder Method |
Description
Deletes a specified folder and its contents.
PowerBASIC Syntax
Arguments
Remarks
The DeleteFolder 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.
An error occurs if no matching folders are found. The DeleteFolder method stops on the first error it encounters. No attempt is made to roll back or undo any changes that were made before an error occurred.
Example [PowerBASIC]
#INCLUDE "windows.inc" #INCLUDE "scrrun.inc"
DIM fso AS IFileSystem
' Create an instance of the FileSystemObject fso = NEWCOM "Scripting.FileSystemObject" ' Delete a folder fso.DeleteFolder UCODE$("C:\MyFolder"), %FALSE IF OBJRESULT = %S_OK THEN MSGBOX "Folder deleted" ELSE MSGBOX "Error &H" & HEX$(OBJRESULT) & " deleting the folder" END IF
|