xHarbour Reference Documentation > Command Reference |
Deletes a file from disk.
ERASE <cFilename> DELETE FILE <cFilename>
ERASE, or its synonym DELETE FILE, is a file command that deletes a file from disk. When <cFilename> does not include drive and directory information, the file is searched only in the current directory. Directories specified with SET DEFAULT or SET PATH are ignored by this command.
The file must be closed before it can be deleted.
When the file <cFilename> is not found or when it is in use, either a runtime error is generated, or a file error occurs that can be queried with function FError().
See also: | CLOSE, CurDir(), FErase(), FError(), File(), FRename(), RENAME, USE |
Category: | File commands |
Source: | rtl\philes.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example deletes a group of index files in the current directory. #include "Directry.ch" PROCEDURE Main LOCAL aDir := Directory( "*.ntx" ) LOCAL i, imax := Len( aDir ) FOR i:=1 TO imax ERASE ( aDir[i,F_NAME] ) NEXT RETURN
http://www.xHarbour.com