Kill statement
Kill filename
Kill only deletes files. To remove a directory use the RmDir statement. Refer to RmDir statement for more information.
Example
Const NumberOfFiles = 3
 
Sub Main()
   Dim Msg   ' Declare variable.
   Call MakeFiles()   ' Create data files.
   Msg = "Several test files have been created on your disk. You may see "
   Msg = Msg & "them by switching tasks. Choose OK to remove the _ 
   test files."
   MsgBox Msg
   For I = 1 To NumberOfFiles
       Kill "TEST" & I   ' Remove data files from disk.
   Next I
End Sub
 
Sub MakeFiles()
   Dim I, FNum, FName   ' Declare variables.
   For I = 1 To NumberOfFiles
       FNum = FreeFile   ' Determine next file number.
       FName = "TEST" & I
       Open FName For Output As FNum   ' Open file.
       Print #FNum, "This is test #" & I   ' Write string to file.
       Print #FNum, "Here is another ";  "line";  I
   Next I
   Close   ' Close all files.
End Sub