CitectVBA Programming Reference > CitectVBA Function Reference > File I/O Functions > Kill

Kill

Kill statement deletes files from disk.

The required File argument must be valid string expression representing a valid file name. Filemay contain a DOS path structure including directory or folder names, and a drive letter.

Kill supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files. The Kill statement does not work on a currently open file. To remove a directory use the RmDir statement.

The file system tracks the current drive and the current directory of every drive. Use the CurDir statement to determine the current directory. The current drive letter can be extracted from the Left character returned in the CurDir statement.

Syntax

KillFile

File:

A string or expression that can represent a valid file name, and may include a DOS path structure including directory or folder names, and a drive letter.

Related Functions

Close | FileCopy | FreeFile | Name | Open

Example

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

' Delete all Dat files in current directory.
Kill "*.Dat"