◄Example► ◄Contents► ◄Index► ◄Back► ────────────────────────────────────────────────────────────────────────────── 'This example uses the KILL statement to delete files. 'Note: This example will not run unless the specified files are found. KILL "DATA1?.DAT" 'Deletes files with a six-character base name 'starting with DATA1 and having the extension .DAT. KILL "DATA1.*" 'Deletes files with the base name DATA1 and any 'extension. KILL "\GREG\*.DAT" 'Deletes files with the extension .DAT in a 'directory called GREG. 'The following example deletes the file specified on the command line. 'Note: To run this example, select Full Menus from the Options menu, then 'select Modify COMMAND$ from the Run menu to specify a file to delete. DEFINT A-Z ON ERROR GOTO Errorhandle 'Set up error handling. FileName$ = COMMAND$ 'Get file name. KILL FileName$ PRINT FileName$ " deleted" END Errorhandle: Number = ERR IF Number = 53 THEN PRINT "Couldn't delete " FileName$ ; PRINT "; file does not exist in current directory" ELSE PRINT "Unrecoverable error:";Number ON ERROR GOTO 0 'Aborts program. END IF RESUME NEXT