FileSystemObject.FileExists()
JScript3.0+Syntax
filesystemobject.FileExists(filename)
Description
The FileExists() method is used to determine whether or not a file exists on the current system. This method takes filename as its only parameter, which represents the name of file to check.
Example
Listing 9.79 shows how to use the FileExists() method to check to see if the file test.txt exists.
Listing 9.79 Example of FileExists()
<html> <body> <script language="JScript"> <!-- Hide function checkfile() { var myObject; // Create an instance of the FileSystemObject myObject = new ActiveXObject("Scripting.FileSystemObject"); // check to see if the file exists and alert user of status if(myObject.FileExists("c:\\test.txt")){ alert("File Exists"); ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.