FileSystemObject.DeleteFile() : FileSystemObject « MS JScript « JavaScript Tutorial






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>








32.11.FileSystemObject
32.11.1.FileSystemObject
32.11.2.FileSystemObject.BuildPath()
32.11.3.FileSystemObject.CopyFile()
32.11.4.FileSystemObject.CopyFolder()
32.11.5.FileSystemObject.CreateFolder()
32.11.6.FileSystemObject.CreateTextFile()
32.11.7.FileSystemObject.DeleteFile()
32.11.8.FileSystemObject.DeleteFolder()
32.11.9.FileSystemObject.DriveExists()
32.11.10.FileSystemObject.Drives
32.11.11.FileSystemObject.FileExists()
32.11.12.FileSystemObject.FolderExists()
32.11.13.FileSystemObject.GetAbsolutePathName()
32.11.14.FileSystemObject.GetBaseName()
32.11.15.FileSystemObject.GetDrive()
32.11.16.FileSystemObject.GetDriveName()
32.11.17.FileSystemObject.GetExtensionName()
32.11.18.FileSystemObject.GetFile()
32.11.19.FileSystemObject.GetFileName()
32.11.20.FileSystemObject.GetFolder()
32.11.21.FileSystemObject.GetParentFolderName()
32.11.22.FileSystemObject.GetSpecialFolder()
32.11.23.FileSystemObject.GetTempName()
32.11.24.FileSystemObject.MoveFile()
32.11.25.FileSystemObject.MoveFolder()
32.11.26.FileSystemObject.OpentextFile()