DeleteFile Method |
Description
Deletes a specified file.
PowerBASIC Syntax
Arguments
Remarks
An error occurs if no matching files are found. The DeleteFile 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 file fso.DeleteFile UCODE$("C:\MyFolder\Test.txt"), %FALSE IF OBJRESULT = %S_OK THEN MSGBOX "File deleted" ELSE MSGBOX "Error &H" & HEX$(OBJRESULT) & " deleting the file" END IF
|