Use the move
method to move files and directories to a new parent directory.
try {
const newParentId = 'new_parent_directory_id' // The ID of the new parent directory.
const childrenIds = ['child_directory_id_1', 'child_directory_id_2'] // An array of child directory IDs to move.
const childrenFileIds = ['child_file_id_1', 'child_file_id_2'] // (optional) An array of child file IDs to move.
await sdk.directory.move(parentId, childrenIds, childrenFileIds)
console.log('Files and directories moved successfully.')
} catch (error) {
console.error(error.message)
}
Params
newParentId
(string): The ID of the new parent directory where the child directories/files will be moved.childDirectoryIds
(string[]): An array of child directory IDs to move.childFileIds
(string[], optional): An array of child file IDs to move (if applicable).
Required API Key Permission
Create Directory
Delete Directory