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 .
public static void Kill (string PathName);
String expression that specifies one or more file names to be deleted.
PathName can include the directory or folder, and the drive.
Target file(s) open.
Target file(s) not found.
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")
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
PathDiscovery flags of FileIOPermission to be granted to the executing code. For more information, see SecurityExceptionCode Access Permissions
- See Also