Skip to content

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

ParameterTypeDescription
oldPathstringCurrent path of the file or folder.
newPathstringNew 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');

Matterway Assistant SDK Documentation