Mega Code Archive

 
Categories / JavaScript Tutorial / MS JScript
 

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>