Syntax
filesystemobject.DeleteFile(filename, force)
The DeleteFile() method deletes an existing file.
filename is a string specifying the file name.
force is a Boolean value indicating whether to delete a file with read only permissions.
<html> <body> <script language="JScript"> <!-- function deleteFile() { var myObject; myObject = new ActiveXObject("Scripting.FileSystemObject"); myObject.DeleteFile("c:\\testing.txt"); } --> </script> Delete Text file "testing.txt" <form name="myForm"> <input type="Button" value="Click to Delete File" onClick='deleteFile()'> </form> </body> </html>