METHOD:  FileSystemObject.FolderExists

object.FolderExists(folder)

This method allows us check if a specified folder exists. It returns a Boolean value - True if the folder does exist and False if it doesn't. Note that if the folder that you are checking for isn't a subfolder of the current folder, you must supply the complete path.

In the following example the FolderExists method is used before creating a new folder to check that it doesn't already exist.

Code:
<%
dim filesys, newfolder
set filesys=CreateObject("Scripting.FileSystemObject")
If  Not filesys.FolderExists("c:\DevGuru\website\") Then
   newfolder = filesys.CreateFolder "c:\DevGuru\website\"
   Response.Write("A new folder '" & newfolder & "' has been created")
End If
%>


Output:
"A new folder 'c:\DevGuru\website\' has been created."

Copyright 1999 by Infinite Software Solutions, Inc.
Trademark Information