> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/zh/clis/cli-assets-and-folders.md).

# CLI：资产与文件夹

在终端用 Unitlab CLI 管理资产与文件夹：上传文件到资产库、设置自定义元数据、创建文件夹、同步云存储文件夹，并创建 Data Group。

## 上传到资产库 <a href="#upload-to-the-library" id="upload-to-the-library"></a>

```bash
unitlab assets upload ./cell-04 --folder "Robot cell 04" --tag site-berlin --tag 2026-11 \
  --custom-metadata '{"robot": "UR10e", "shift": "night"}' --json
```

| 选项                                             | 用途                      |
| ---------------------------------------------- | ----------------------- |
| `--folder` 或 `--folder-id`                     | 按名称（新建或复用）或按 ID 指定目标文件夹 |
| `--path`                                       | 目标文件夹内的子文件夹路径           |
| `--tag`                                        | 重复使用以添加多个标签             |
| `--custom-metadata` 或 `--custom-metadata-file` | 应用到每个文件的 JSON 对象        |
| `--type`                                       | 强制指定类型，例如 `pointcloud`  |
| `--dry-run`, `--split-sensor-folders`          | 用于 LiDAR 场景             |

## 处理状态与元数据 <a href="#processing-and-metadata" id="processing-and-metadata"></a>

```bash
unitlab assets status "$ASSET_ID"
unitlab assets retry "$ASSET_ID"
unitlab assets set-metadata "$ASSET_ID" --custom-metadata '{"lighting": "low"}'
unitlab assets set-metadata "$ASSET_ID" --custom-metadata null
```

`set-metadata` 会替换整个对象，`null` 则清空元数据。

## 文件夹 <a href="#folders" id="folders"></a>

```bash
FOLDER_ID=$(unitlab folders create "Robot cell 04" --json | jq -r .id)
unitlab folders create cam_front --parent "$FOLDER_ID"
unitlab folders list --parent "$FOLDER_ID"
unitlab folders items "$FOLDER_ID" --json
unitlab folders detail "$FOLDER_ID"
```

云存储文件夹会镜像存储桶的某个前缀：

```bash
INCOMING=$(unitlab folders create Incoming --cloud-storage "$CLOUD_STORAGE_ID" --prefix fleet/incoming/ --json | jq -r .id)
unitlab folders sync-cloud "$INCOMING"
```

## Data Group <a href="#data-groups" id="data-groups"></a>

```bash
unitlab assets group "$FOLDER_ID" --preview                    # show the suggested pattern
unitlab assets group "$FOLDER_ID"                              # group with the suggestion
unitlab assets group "$FOLDER_ID" --template "{cell}_{frame}_{view}" \
  --tile-values "view=front,left,right,wrist" --preview      # estimate a pattern
unitlab assets group "$FOLDER_ID" --config grouping.json       # a saved configuration
```

`--tile-values` 的格式为 `field=value1,value2`；多个字段时重复该选项。配置键说明见 [Data Group 自动化](https://docs.unitlab.ai/api-sdk-cli/zh/sdks/data-group-automation.md)。

## 相关内容 <a href="#related" id="related"></a>

[资产与自定义元数据](https://docs.unitlab.ai/api-sdk-cli/zh/sdks/assets-and-custom-metadata.md) · [文件夹](https://docs.unitlab.ai/api-sdk-cli/zh/sdks/folders.md)
