Creates an on-disk or in-memory directory in the specified path

directoryCreate(path) → returns void

Argument Reference

path string

Absolute path of the directory to be created. Alternatively, you can specify an IP address, as in the following example: DirectoryCreate("//". NOTE: You have to have the required permissions to run this function.);

createPath boolean
Default: true

Lucee Only. Create parent directory when it doesn't exist.

ignoreExists boolean
Default: false

Lucee Only. Pass false (default) to throw an error if the directory already exists, or true to skip the create operation without an error.

Sample code invoking the directoryCreate function

Checking if a directory called 'icons' exists and then creating the directory if it does not exist.

if (!directoryExists(expandPath('/assets/img/icons'))) {

Expected Result: The directory 'icons' will be created under the img folder.

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub