This documentation is archived and is not being maintained.

Kill Function

Deletes files from a disk.

Public Sub Kill(ByVal PathName As String)

Parameter

PathName
Required. String expression that specifies one or more file names to be deleted. PathName may include the directory or folder, and the drive.

Exceptions/Errors

Exception type Error number Condition
IOException 55 Target file(s) open.
FileNotFoundException 53 Target file(s) not found.

Remarks

Kill supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files.

Example

This example uses the Kill function to delete a file from a disk.

' Assume TESTFILE is a file containing some data.
Kill("TestFile")   ' Delete file.

' Delete all *.TXT files in current directory.
Kill("*.TXT")   

Smart Device Developer Notes

This function is not supported.

Requirements

Namespace: Microsoft.VisualBasic

Module: FileSystem

Assembly: Microsoft Visual Basic .NET Runtime (in MicrosoftVisualBasic.dll)

See Also

RmDir Function | IOException Class | FileNotFoundException Class

Show: