Kill

=Kill=

Run BASIC allows you to delete files on disk with the **Kill** statement. The syntax is as follows:

KILL filepath$ //- Delete the file specified by filepath$//

Attempting to **Kill** a file that does not exist results in a runtime error. Before the **Kill** statement is used, the Files statement can be used to test file existence.

The following small program creates a sample file, then deletes it with the **Kill** statement.

code format="vbnet" open "testkill.txt" for output as #f print #f, "Some text." close #f

kill "testkill.txt"

code