Kill statement (LotusScript Language)

Deletes a file.

Syntax

Kill fileName

Elements

fileName

A string expression whose value is a file name; wildcards are not allowed. fileName can contain a drive indicator and path information.

Usage

Use Kill with care. If you delete a file with the Kill statement, you can't restore it with LotusScript® statements or operating system commands. Make sure the file is closed before you attempt to delete it.

Kill deletes files, not directories. To remove directories, use the RmDir statement.

If a file does not exist, the Kill statement throws error Path/file access error (ErrPathFileAccessError in lserr.lss).

Sample function to delete a file and (instead of an error) return True if deletion succeeded and False if it failed:

Function DeleteFile(Byval filename As String) As Boolean
   On Error Goto Fail
   Kill filename
   DeleteFile = True
Fail:
   Exit Function
End Function

Example