directoryExists
Description
Determines whether on-disk or in-memory directory exists.
Categories
Related
Syntax
DirectoryExists(absolute_path)
Attributes
| Attribute | Description | Required | Default |
|---|---|---|---|
| absolute_path | An absolute on-disk or in-memory path. Alternatively, you can specify IP address as in the following example: DirectoryExists("//12.3.123.123/c_drive/test"); |
Returns
Yes,
if the specified directory exists; No, otherwise.
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>
Your directory exists. Directory name: #yourDirectory#
</cfoutput>
<cfelse>
Your directory does not exist.</p>
</cfif>
</cfif>
</cfif>