ListFolders(path, [searchPattern], [recursive], [includeCounters]) Last updated: 11. Oct 2024

The fastest function to retrieve a list of folders from a specific path.

Parameters

Name Type Description
path string Path from which to list folders.
searchPattern (optional) string Wildcard for search, default is *.
If not specified, all folders will be returned.
recursive (optional) bool Return folders from all subfolders also.
If not specified, default is "false".
includeCounters (optional) bool Returns number of files in each folder.
If not specified, default is "false".

Returns

An array of folder objects containing folder information.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    /* Get all folders starting with "example" */
    let folders = docly.listFolders("/Test files", "example*");
    
    /* List all folders */
    for(let folder of folders)
    {
        var json = JSON.stringify(folder);
        var html = JSON.format(json).replace(chr(13), "");
        write(html);
        write(chr(13) + "-----------------------------" + chr(13));
    }
}#