Home > DMT_Folder > moveFolderToFolder
DMT_Folder.moveFolderToFolder() method
移动文件夹
签名
typescript
function moveFolderToFolder(
teamUuid: string,
folderUuid: string,
parentFolderUuid?: string,
): Promise<boolean>;1
2
3
4
5
2
3
4
5
参数名
参数 | 类型 | 描述 |
|---|---|---|
teamUuid | string | 团队 UUID |
folderUuid | string | 文件夹 UUID |
parentFolderUuid | string | (可选) 父文件夹 UUID,如若不指定,则默认为根文件夹 |
返回值
Promise<boolean>
是否移动成功
示例
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