moveFolder(folderPath, destinationPath) Last updated: 17. Oct 2026
API only function
Moves a folder to a new location within your site.
See also: Path traversal
Parameters
| Name | Type | Description |
|---|---|---|
| folderPath | string | Path of the folder you want to move, from the site root (e.g. "myFolder" or "parent/child"). Separate levels with / — a backslash is not a path separator. |
| destinationPath | string | Path of the folder to move it into, from the site root (e.g. "folder2/folder3"). |
Returns
A result object with Success and Message. Throws an error if the folder or the destination is not found, if the destination already has a folder with the same name, if you try to move a folder into itself, or if either folder only exists in the app the site is published from.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Move "folder1" from the root into "folder2/folder3"
docly.moveFolder("folder1", "folder2/folder3");
// Verify that the folder now exists at its new location
write(docly.folderExists("folder2/folder3/folder1"));