GetFolders(path, [searchPattern], [depth]) Last updated: 08. Feb 2024

Gets a list of all subfolders below a specific folder.

Parameters

Name Type Description
path string Absolute path to the folder which you want to list sub folders for.
searchPattern (optional) string Enter a wildcard of files to retreive, default is "*"
depth (optional) number How many extra levels of subfolders, default is 0

Returns

An array of folder objects.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    // 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);
}#

Output

The #JS code above produces the output shown below:
[
  {
    "Name": "Folder 1",
    "Url": "/Test-files/Folder-1",
    "DoclyId": 45972,
    "Guid": "3rujvHyLOE-BkiQUUX5Kng",
    "LastModified": "2022-12-21T11:43:22.6787708+01:00",
    "Size": 0
  },
  {
    "Name": "Folder 2",
    "Url": "/Test-files/Folder-2",
    "DoclyId": 45973,
    "Guid": "4KBt5OiHKUO_CMfMjN4rUA",
    "LastModified": "2022-12-21T11:43:25.4081419+01:00",
    "Size": 0
  },
  {
    "Name": "Folder 3",
    "Url": "/Test-files/Folder-3",
    "DoclyId": 45974,
    "Guid": "rXOvQs861068dtNVyXh3nQ",
    "LastModified": "2022-12-21T11:43:27.6845486+01:00",
    "Size": 0
  }
]