In contrast to FileDelete(), which permits to specify file groups with wildcards, DeleteFile() only accepts specific file names. However, the function avoids all DOS error messages and returns an error code directly to the calling program. This makes error-tolerant erasures in networks possible.

Note

. You can use a drive designator and path name, but no wildcards.

Examples

. How NOT to delete a file in a network environment:
IF FILE ("TEST.DBF")
* Is it actually possible to delete the file?
DELETE FILE TEST.DBF
ENDIF
. This is a better way:
nStatus := DeleteFile("TEST.DBF")
IF nStatus == 0
? "File deleted."
ELSE
IF nStatus == -5
? "ACCESS DENIED!"
? "File in use elsewhere!"
ENDIF
ENDIF