Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
DELETE Keyword
DELETE string-expression

Deletes the specified file from the filesystem.

  • string-expression must evaluate to a filename or path.
  • Paths are case-insensitive.
  • Relative paths are resolved against the current directory (see CHDIR).
  • . and .. are not supported in paths.
Note
This is a destructive operation (no undo).
If the file does not exist, or cannot be removed (for example because it is currently open),
a runtime error is raised (catchable with ON ERROR).
DELETE removes files only. To remove a directory, use RMDIR.

Example: simple delete
DELETE "old_config.txt"

Example: defensive delete (only if it’s a file)
IF FILETYPE$("backup.dat") = "FILE" THEN
DELETE "backup.dat"
ELSE
PRINT "Not a file, skipping."
ENDIF

Notes
  • Ensure any open handles to the file are closed first with CLOSE.
  • Wildcards are not supported; delete files one at a time.
  • Deleting a non-existent file raises an error.

See also:
OPENIN · OPENOUT · OPENUP · CLOSE · RMDIR · CHDIR · FILETYPE$