Kill

File management function.

The Kill function deletes one or more files.

Usage

Do not kill files using Del key in Explorer; the selection of the file to kill is not reliable as the way to display files in Explorer depends on Windows settings for each user. Use instead Kill function. Wildcards (* or ? characters) are allowed in the file names. As Kill returns an error if you try to delete a file which does not exist, you can first check that the file exists using Exist function.

Syntax

Kill(<filename>)
or
ret=Kill(<filename>)

Parameters

<filename>, string, name of the file(s) to be deleted. Wildcard characters can be included in the file name parameter.

Return value

Ret, numeric return code. When the deletion is successful, the function returns 0, otherwise use this return code for Error Handling.

Remarks

The function works the same as the DOS statement DEL.

Examples

 

Kill("c:\*.txt")

Result = Kill(file$)