FileSystemObject.DeleteFile() : FileSystemObject : MS JScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » MS JScript » FileSystemObject »

 

FileSystemObject.DeleteFile()











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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo MS JScript
» FileSystemObject