DirectoryCreate

Creates a directory

Method Signature

DirectoryCreate(path=[string], createPath=[boolean], ignoreExists=[boolean], mode=[string])

Arguments

Argument
Type
Required
Description
Default

path

string

true

The directory path to create

createPath

boolean

false

[true] Whether to create all paths necessary to create the directory path

true

ignoreExists

boolean

false

[false] Whether to ignore if a directory already exists

false

mode

string

false

When provided will attempt to set the posix permissions on the directory

Examples

Script Syntax

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

Run Example

if( !directoryExists( expandPath( "/assets/img/icons" ) ) ) {
	directoryCreate( "assets/img/icons" );
}

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

Additional Examples

Run Example

// This will create parent directory when not exist
directoryCreate( expandPath( "images/uploads" ), true, true );

Last updated

Was this helpful?