DirectoryList()
Lists the directory and returns the list of files under it as array or query
DirectoryList( path=string, recurse=boolean, listInfo=string, filter=any, sort=string, type=string );
Returns: any
| Argument | Description |
|---|---|
|
path
string,
required
|
edit
The absolute path of the directory to list the content from. This can be any type of supported Virtual File Systems Alias: absolute_path, absolutePath |
|
recurse
boolean,
optional
|
edit
Specifies whether to include subdirectories in the listing. If |
|
listInfo
string,
optional
|
edit
Defines the return type of this function:
|
|
filter
any,
optional
|
edit
Specifies a filter to be used to filter the results:
|
|
sort
string,
optional
|
edit
Query columns by which to sort a directory listing. Applies to all Delimited list of columns from query output. Sorting is case sensitive. To qualify a column, use one of the following values:
|
|
type
string,
optional
|
edit
type of the result returned:
|
Usage Notes
editThe Unix mode column was not populated prior to Lucee 6.1
Prior to Lucee 7.1, sort was only applied when listInfo was query and was ignored for name and path (LDEV-3188).
Examples
editTo return an array of file paths that end with the substring .log from a the directory /var/data:
directoryList("/var/data", false, "path", function(path){ return arguments.path.hasSuffix(".log"); })