View comments | RSS feed

DirectoryExists

Description

Determines whether a directory exists.

Return value

Yes, if the specified directory exists; No, otherwise.

Category

System functions

Syntax

DirectoryExists(absolute_path)

See also

FileExists

Parameters

Parameter Description
absolute_path
An absolute path

Example

<h3>DirectoryExists Example</h3>
<h3>Enter a directory to check for existence.</h2>
<form action = "directoryexists.cfm" method="post">
  <input type = "text" name = "yourDirectory">
  <br>
  <input type = "submit" name = "submit">
</form>

<cfif IsDefined("FORM.yourDirectory")>
  <cfif FORM.yourDirectory is not "">
  <cfset yourDirectory = FORM.yourDirectory>
    <cfif DirectoryExists(yourDirectory)>
      <cfoutput>
      <p>Your directory exists. Directory name: #yourDirectory#
      </cfoutput>
    <cfelse>
      <p>Your directory does not exist.</p>
    </cfif>
  </cfif>
</cfif> 

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6

Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.

Comments


Kris DeLaney said on Dec 12, 2004 at 8:46 AM :
Many Macomedia's tag examples, such as this one, do not work. This one does not work for multiple reasons. I know why, do you?
jrunrandy said on Apr 11, 2005 at 12:13 PM :
This example works. Just be sure to name the file directoryexists.cfm or change the Action attribute.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt172.htm