FileSystem.Kill(String) FileSystem.Kill(String) FileSystem.Kill(String) FileSystem.Kill(String) Method


Deletes files from a disk. The My feature gives you better productivity and performance in file I/O operations than Kill. For more information, see FileSystem .

 static void Kill(System::String ^ PathName);
public static void Kill (string PathName);
static member Kill : string -> unit
Public Sub Kill (PathName As String)


String String String String

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



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 supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files.

Security Note In order to execute, the Kill function requires Read and PathDiscovery flags of FileIOPermission to be granted to the executing code. For more information, see SecurityExceptionCode Access Permissions

Applies to

See also