folderExists(path) Last updated: 17. Oct 2026
API only function
Checks whether a folder exists in the site, including folders the site inherits from the app (publish template) it runs from.
Only available in API scripts. In a page or template, use docly.getFolder(path) != null instead.
See also: fileExists getFolder Path traversal
Parameters
| Name | Type | Description |
|---|---|---|
| path | string | Path to check if a folder exists for. |
Returns
true if the folder exists, otherwise false (also for an empty path).
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Check if there is a folder with name "folder1" that has a sub folder called "subfolder1"
if (docly.folderExists("folder1/subfolder1"))
write("Folder exists!");