Determines whether an on-disk or in-memory directory exists.

directoryExists(path) → returns boolean

directoryExists Argument Reference

path string

An absolute on-disk or in-memory path. Alternatively, you can specify IP address as in the following example: DirectoryExists("//");

allowRealPath boolean

Lucee Only. boolean that defines if relative paths are interpreted or not.

Examples sample code invoking the directoryExists 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.

Fork me on GitHub