Appearance
Function: renameFileOrFolder()
ts
function renameFileOrFolder(oldPath: string, newPath: string): Promise<void>;Defined in: src/file/offerMwFile.tsx:373
Experimental
Rename a file or folder.
Parameters
| Parameter | Type | Description |
|---|---|---|
oldPath | string | Current path of the file or folder. |
newPath | string | New path with the desired name. |
Returns
Promise<void>
Resolves when the rename is complete.
Example
ts
await renameFileOrFolder(
'/Users/me/Documents/draft.docx',
'/Users/me/Documents/final-thesis.docx',
);
console.log('Renamed draft to final thesis');