KILL

KILL(pathname)

Deletes an existing file.


pathnameThe full pathname of the file to be deleted (String).

REMARKS
* This statement supports wildcards (? and *).
* This statement can be used to remove whole directories.
* This statement cannot be used to delete read only files.
* If you try to delete a file that does not exist you will get a run-time error.
* If you try to delete a file that is currently open you will get a run-time error.
* You can delete whole directories or folders using the RMDIR statement.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.Kill
* For the Microsoft documentation refer to learn.microsoft.com

Kill "C:\Temp\FileName.txt" 
Kill "C:\Temp\" & "FileName.txt"

This will delete all files with a .txt file extension
Kill "C:\Temp\*.txt"

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top