FileSystemObject determines whether the drive letter, folder, and file exist. filesystemobject
DriveExists (drive letter)
Check whether a disk exists
FileExists (file name)
Check whether a file exists
FolderExists (directory name)
Check whether a folder exists
Example:
<HTML> <HEAD> <TITLE> filesystemobject </TITLE> <script type = "text/javascript"> var fso = new ActiveXObject ("Scripting. fileSystemObject "); hasDriveD = fso. driveExists ("d"); // check whether the system has a d disk. hasDriveZ = fso. driveExists ("z"); // check if the system has a Z disk if (hasDriveD) {alert ("You have a D disk in your system");} if (! HasDriveZ) {alert ("your system does not have a Z disk");} var fileName = fso. fileExists ("c: \ boat.txt"); if (fileName) {alert ("You Have A boat.txt file in the c drive");} var folderName = fso. folderExists ("c: \ Windows \ System32"); if (folderName) {alert ("System32 folder exists! ") ;}</Script> </HEAD> <BODY> </HTML>