Whatever message this page gives is out now! Go check it out!

DirectoryCreate

Last update:
May 18, 2026

Description

Creates on-disk or in-memory directory.

Category

Function Syntax

DirectoryCreate(path)

See Also

History

ColdFusion 9: Added this function

Parameters

Parameter
Description
path
Absolute path of the directory to be created. Alternatively, you can specify IP address, as in the following example: DirectoryCreate("//12.3.123.123/c_drive/test");

Usage

Ensure that you have the required permissions to run this function.

Example

The following code illustrates how to create a directory:
<h2>DirectoryCreate Example</h2> 
<h3>Enter a directory to create.</h3> 
<cfform action = "directorycreate.cfm" method="post" preservedata="true" > 
<cfinput type = "text" required="true" name = "createDirectory"> 
<br> 
<cfinput type = "submit" value="submit" name = "submit"> 
</cfform> 

<cfif IsDefined("FORM.createDirectory")> 
<cfif FORM.createDirectory is not ""> 
<cfset createDirectory = FORM.createDirectory> 
<cftry> 
<cfset DirectoryCreate(createDirectory)> 
<cfoutput><b>Directory #createDirectory# successfully created.</b></cfoutput> 
<cfcatch> 
<b>Error Message:</b><cfoutput>#cfcatch.message#</cfoutput><br/> 
<b>Error Detail:</b><cfoutput>#cfcatch.Detail#</cfoutput> 
</cfcatch> 
</cftry> 
</cfif> 
</cfif>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page