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


JAVASCRIPT TUTORIALS » MS JScript » FileSystemObject »

 

FileSystemObject.FileExists()










Syntax








filesystemobject.FileExists(filename)



The FileExists() method determines whether a file exists.

This method takes filename as its only parameter.












<html>
    <body>
    <script language="JScript">
    <!--
    function checkfile()
    {
        var myObject;
        myObject = new ActiveXObject("Scripting.FileSystemObject");
        if(myObject.FileExists("c:\test.txt")){
           alert("File Exists");
        else {
           alert("File doesn't exist");
        }
    }
    -->
    </script>
    Check for file "test.txt"
    <form name="myForm">
    <input type="Button" value="Check file" onClick='checkfile()'>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo MS JScript
» FileSystemObject