Docly Developers
Function Updated 25 Oct 2026

getFolders(path, [options])

Gets a list of all subfolders below a specific folder.

Parameters

pathstringrequired

Absolute path to the folder which you want to list sub folders for.

optionsobjectoptional
Specify any of the following options parameters:
namestring

Enter a wildcard of folders to retrieve, default is "*"

depthnumber

How many extra levels of subfolders, default is 0

recursivebool

Get sub folders recursively, default false.

propertiesbool

Get with folder properties, default true.
Use false for faster execution without this extra information.

filterobject | function

Filter items based on their properties. Accepts either:

  1. Object with key-value pairs for exact matching (e.g. { "Status": "active" })
  2. Function that receives each folder and returns true/false (e.g. x => x.Size > 1000000 && x.Status == "active")
fieldscsv | array | object

Specify fields to retrieve via:

  1. CSV string (e.g. "Name,Url")
  2. Array of strings (e.g. ["Name","Url"])
  3. Object map for renaming (e.g. {"title":"Name"})
includeCountersbool

Add a Count field to each folder with the number of documents it contains, default false. Deleted documents and the folder properties file are not counted. Returns the same number as listFolders.

Returns

An array of folder objects. Every object carries Name, Url, Path, DoclyId, Guid, Created, LastModified and Size — the same names and date form getFolder uses for the fields they share. Count is added only when includeCounters is true. Unless you pass properties: false, the folder's own fields from its folder document are merged in first, so a custom field sharing one of the standard names above is overwritten by the standard value; Count is the exception and is left alone unless you ask for counters.

Folders whose name starts with # are never included, nor is anything below them, nor are folders the site's publisher has no website (Visit) access to. Access is that of the user who published the site — the user the site runs as — not of the visitor, so the result is the same for everyone. To tailor a list to the signed-in visitor in an API script, check each item with allowVisit. Properties of encrypted folders are left out — read them with getFolderProps after unlockFolder. An unknown folder gives an empty array; a path containing .. or a backslash gives null.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    // Get the list of files
    var list = docly.getFolders("Test files");
    
    // The rest of the code just outputs the list in the demo field below
    var json = JSON.stringify(list);
    var formatted = docly.formatJson(json);
    var html = formatted.replace(chr(13), "");
    write(html);
}#