renameFolder(folderPath, newName) Last updated: 05. May 2026
API only function
Renames an existing folder without moving it. The folder remains in its current parent directory but receives a new name.
See also: renameFile folderExists getFolder
Parameters
| Name | Type | Description |
|---|---|---|
| folderPath | string | Entire absolute path for folder to rename. |
| newName | string | New name without path. |
Returns
Boolean, true if successful.
Throws an error if the source path is not specified, the new name is not specified, or the folder does not exist.
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.// Renames folder in specified location, folder stays in the same parent folder
docly.renameFolder("ParentFolder/OldFolderName", "NewFolderName");
// Example with error handling
try {
docly.renameFolder("Projects/MyProject", "MyRenamedProject");
console.log("Folder renamed successfully");
} catch (e) {
// Throws if path is empty, name is empty, or folder does not exist
console.log("Failed to rename folder: " + e);
}