Features
      Ask DevGuru
      ASP Resources
      Find the Bug
      Knowledge Base
      Links
      Tips of the Week
      Tutorials
  Products
      dgCalendar
      dgCharge New!
      dgChart New!
      dgFileUpload
      dgReport New!
      dgSort
      dgTree
  Site
      Authoring
      Coming Soon
      DevGuru Resume
      Link to Us
      Merchandise
      Sponsorships
      Testimonials
      What's New
  Technologies
      ADO 2.6
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      Transact-SQL Syntax
      VBScript
      WML
      WMLScript
      WSH
      XML DOM

              











METHOD:  FileSystemObject.FolderExists

Implemented in version 2.0
 
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-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information