Home > DMT_Folder > moveFolderToFolder
DMT_Folder.moveFolderToFolder() method
Move folder
Signature
typescript
function moveFolderToFolder(
teamUuid: string,
folderUuid: string,
parentFolderUuid?: string,
): Promise<boolean>;1
2
3
4
5
2
3
4
5
Parameters
Parameter | Type | Description |
|---|---|---|
teamUuid | string | Team UUID |
folderUuid | string | Folder UUID |
parentFolderUuid | string | (Optional) Parent folder UUID. If not specified, it defaults to the root folder |
Returns
Promise<boolean>
Whether the move is successful
Example
javascript
// 1. 取当前工程所属团队
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 创建父、子两个测试文件夹,等 1.5s 让工作区同步
const parentUuid = await eda.dmt_Folder.createFolder('嘉立创示例_父目录', teamUuid);
const childUuid = await eda.dmt_Folder.createFolder('嘉立创示例_子目录', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 把子目录移动到父目录下
const moved = await eda.dmt_Folder.moveFolderToFolder(teamUuid, childUuid, parentUuid);
// 4. 等 1s 后回读,验证子目录的父级已变为父目录
await new Promise(r => setTimeout(r, 1000));
const childInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, childUuid);
console.log('moved:', moved);
console.log('child parentFolderUuid:', childInfo?.parentFolderUuid, '(expect:', `${parentUuid})`);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18