November 11, 2000 - Deleting a File
November 11, 2000 Deleting a File Tips: November 2000
Yehuda Shiran, Ph.D.
|
delete()
method of the File
object. Here is a piece of script that will delete a given file:
<SCRIPT LANGUAGE="JavaScript">
<!--
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
file = myActiveXObject.GetFile("c:\\test.txt");
file.Delete();
// -->
</SCRIPT>
Notice that the File
object's methods are case sensitive. Failing to specify "Delete
" instead of "delete
" will result in a JavaScript error. Also, after you delete a file, any attempts to delete it again will result in a JavaScript error: "No File Found
".