|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Deletes files from a disk.
The My feature gives you greater productivity and performance in file I/O operations than Kill. For more information, see.
Required. String expression that specifies one or more file names to be deleted. PathName can include the directory or folder, and the drive.
|Exception type||Error number||Condition|
Target file(s) open.
Target file(s) not found.
See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the.) However, when possible, you should consider replacing such error control with .
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 Code Access Permissionsto be granted to the executing code. For more information, see SecurityException, and
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)