DirectoryExists

Returns YES if the directory specified in the argument does exist; otherwise, it returns NO.

Note

To check for the existence of a directory, ColdFusion must have access rights to its drive.

See also FileExists.

Syntax

DirectoryExists(absolute_path)
absolute_path

Any absolute path.

Examples

<!--- This example shows the use of DirectoryExists --->
<HTML>
<HEAD>
<TITLE>
DirectoryExists Example
</TITLE>
</HEAD>

<BODY bgcolor=silver>
<H3>DirectoryExists Example</H3>

<CFSET thisPath=ExpandPath("*.*")>
<CFSET thisDirectory=GetDirectoryFromPath(thisPath)>
<CFSET thisDirectory= Left(thisDirectory, Len(thisDirectory) - 1)>

<CFOUTPUT>
The current directory is: #GetDirectoryFromPath(thisPath)#
<CFIF IsDefined("FORM.yourDirectory")>
<CFIF FORM.yourDirectory is not "">
<CFSET yourDirectory=FORM.yourDirectory>
    <CFIF DirectoryExists(yourDirectory)>
    <P>Your directory exists.  You entered
    a valid directory name, #yourdirectory#

...