Skip to main content

文件记录上传

文件记录​

用于管理文件记录中的文件(上传、查看、下载),以下为 gym file --help 列举的功能并附简单例子。

Usage: gym file [options] [command]

文件管理 (上传/列表/下载)

Options:
-h, --help 显示帮助信息

Commands:
upload [options] 上传文件或文件夹到记录(支持多个来源)
list [options] 列出记录下的文件
download [options] 下载记录下的文件
help [command] display help for command

创建文件记录​

Usage: gym record create [options]

创建新的文件记录

Options:
-t, --title <title> 记录标题(必填)
-P, --project-id <projectId> 所属项目 ID(必填)
-d, --device-id <deviceId> 关联设备 ID
--description <text> 记录描述
--visibility <public|private> 可见性,默认 private
-h, --help 显示帮助信息

gym record create 用于在平台创建新的文件记录,后续可通过 gym file upload 上传文件到该记录。

选项简写说明必填
--title-t记录标题是
--project-id-P所属项目 ID,可通过 gym project list 查询是
--device-id-d关联设备 ID,可通过 gym device list 查询否
--description-记录描述否
--visibility-可见性:public(公开)或 private(私有)否(默认私有)
# 默认创建私有记录
gym record create -t "内部测试数据" -P 20xxxxxxxxxxxxxxx0

# 显式指定私有
gym record create -t "传感器数据" -P 20xxxxxxxxxxxxxxx0 --visibility private

# 创建公开记录(同样需要指定项目)
gym record create -t "传感器日志采集" -P 20xxxxxxxxxxxxxxx0 --visibility public

# 创建记录并关联设备和描述
gym record create -t "机器臂运动数据" -P 20xxxxxxxxxxxxxxx0 -d 20xxxxxxxxxxxxxxx9 --description "2026年6月采集"
提示
  • 不管是私有还是公开记录,都必须指定 -P, --project-id
  • 默认创建私有记录,仅创建者可见
  • 公开记录对组织内所有成员可见,通过 --visibility public 创建
  • 创建成功后终端会显示 ✓ 创建记录成功

上传文件​

Usage: gym file upload [options]

上传文件或文件夹到记录(支持多个来源)

Options:
-r, --record-id <recordId> 记录ID(必填)
-s, --source <path...> 一个或多个文件/文件夹路径(必填)
-p, --path <path> 目标路径(相对于记录根目录)
-h, --help 显示帮助信息

gym file upload 用于将本地文件或文件夹上传到指定文件记录。

选项简写说明必填
--record-id-r目标文件记录 ID是
--source-s本地文件或文件夹路径,支持多个是
--path-p记录内的目标路径,不填则放在根目录否
# 上传单个文件到记录
gym file upload -r 20xxxxxxxxxxxxxxx33 -s ./data.bag

# 上传整个文件夹
gym file upload -r 20xxxxxxxxxxxxxxx33 -s ./my_data/

# 上传到记录的指定子目录
gym file upload -r 20xxxxxxxxxxxxxxx33 -s ./data.bag -p subdir/

# 一次上传多个文件/文件夹
gym file upload -r 20xxxxxxxxxxxxxxx33 -s ./file1.bag ./file2.bag ./folder/

上传文件夹时,会自动在记录中创建对应的目录结构,保持与本地一致的层级。

列出文件​

Usage: gym file list [options]

列出记录下的文件

Options:
-r, --record-id <recordId> 记录ID(必填)
-p, --prefix <prefix> 路径前缀,用于浏览子目录
-l, --limit <number> 最大返回数量 (default: "100")
-h, --help 显示帮助信息

gym file list 列出指定记录下的文件和目录。

选项简写说明默认值
--record-id-r文件记录 ID必填
--prefix-p路径前缀,用于查看子目录内容空
--limit-l最大返回条数100
# 列出记录根目录下的文件
gym file list -r 20xxxxxxxxxxxxxxx33

# 查看记录中某个子目录
gym file list -r 20xxxxxxxxxxxxxxx33 -p subdir/

# 限制返回数量
gym file list -r 20xxxxxxxxxxxxxxx33 -l 20

输出示例:

文件列表:

名称 | 类型 | 大小 | 修改时间
────────────────────────────────────────────────────────────────────────
[D] subdir/ | dir | - | 2025-06-15 10:30:00
data.bag | bag | 407.0 MB | 2025-06-15 09:22:00
info.json | json | 2.1 KB | 2025-06-15 09:20:00
README.md | md | 1.5 KB | 2025-06-15 09:18:00
────────────────────────────────────────────────────────────────────────
共 4 项

目录项以 [D] 前缀标识,文件显示对应的扩展名类型。

下载文件​

Usage: gym file download [options]

下载记录下的文件

Options:
-r, --record-id <recordId> 记录ID(必填)
-f, --file-path <filePath> 文件路径(必填)
-o, --output <output> 本地保存路径 (default: ".")
-h, --help 显示帮助信息

gym file download 用于下载记录中的单个文件到本地。

选项简写说明默认值
--record-id-r文件记录 ID必填
--file-path-f记录中的文件路径必填
--output-o本地保存路径,可以是目录或具体文件名当前目录
# 下载文件到当前目录
gym file download -r 20xxxxxxxxxxxxxxx33 -f data.bag

# 下载到指定目录
gym file download -r 20xxxxxxxxxxxxxxx33 -f data.bag -o ./downloads/

# 下载并重命名
gym file download -r 20xxxxxxxxxxxxxxx33 -f data.bag -o ./my_data.bag

# 下载子目录中的文件
gym file download -r 20xxxxxxxxxxxxxxx33 -f subdir/config.json -o ./

文件记录查询​

在操作文件之前,需要先获取文件记录的 ID。可通过 gym record list 查询当前用户可访问的文件记录:

Usage: gym record list [options]

分页查询记录列表

Options:
-p, --page <number> 页码 (default: "1")
-l, --limit <number> 每页数量 (default: "10")
-h, --help 显示帮助信息
# 查看文件记录列表
gym record list

输出示例:

文件记录列表

记录ID | 名称 | 所属项目 | 关联设备 | 文件数 | 记录大小 | 创建者 | 标签 | 更新时间
────────────────────────────────────────────────────────────────────────────────────────────────────────
20xxxxxxxxxxxxxxx33 | 任务数据记录 | 示例项目 | P4-200 | 12 | 2.3 GB | 张三 | | 2025-06-15 10:30:00
20xxxxxxxxxxxxxxx38 | 传感器日志 | 示例项目 | LB_21 | 5 | 156.8 MB | 李四 | | 2025-06-14 16:20:00
────────────────────────────────────────────────────────────────────────────────────────────────────────
总2条 | 第1页 | 每页10条 | 当前页2条

文件类型识别​

上传时,CLI 会根据文件扩展名自动识别文件类型:

扩展名类型
.bag .mcap .rosbagbag
.jpg .jpeg .png .gif .webp .bmp .svg .tiff .icoimage
.mp4 .webm .ogg .mov .avi .mkvvideo
.pdfpdf
.xls .xlsx .csv .tsvtable
.doc .docxword
.txt .md .json .xml .html .css .js .ts .py .java .yaml .yml .log .conf .shtext
其他file

常见问题​

上传前如何确认记录 ID?​

使用 gym record list 查看所有可访问的文件记录,复制目标记录的 ID。记录通常由数据上传任务或文件导入操作创建。

提示"存储额度不足"​

上传前 CLI 会自动检查组织的存储配额,额度不足时拒绝上传。请联系管理员扩容或清理无用数据。

提示"下载额度不足"​

下载前 CLI 会检查下行流量配额,额度不足时拒绝下载。请联系管理员扩容。

上传文件夹时部分文件失败​

CLI 会逐个上传文件夹内的文件,失败的文件不会影响其他文件继续上传。最终会汇总输出成功/失败统计。

相关文档​