SuperAPI AI Directory

feishu-cli-file

Office & productivity

View repository

Updated 10-16 08:00

About this skill

Feishu cloud space file management skill

Manage files and folders in Feishu cloud space (Drive), including list, create, move, copy, and delete operations.

Usage

/feishu-file list [folder_token]         # 列出文件
/feishu-file mkdir <name> [--parent]     # 创建文件夹
/feishu-file move <token> --target       # 移动文件
/feishu-file copy <token> --target       # 复制文件
/feishu-file delete <token>              # 删除文件

CLI command details

1. List folder contents

# 列出根目录(我的空间)
feishu-cli file list

# 列出指定文件夹
feishu-cli file list <folder_token>

Output example:

文件列表(文件夹: root):
  1. [文件夹] 项目文档
     Token: fldcnxxx
     修改时间: 2024-01-21 14:30

  2. [docx] 会议纪要
     Token: doccnxxx
     修改时间: 2024-01-20 10:15

  3. [sheet] 数据表格
     Token: shtcnxxx
     修改时间: 2024-01-19 16:45

File type:

Type Description
folder Folder
docx Cloud document
sheet Spreadsheet
bitable Base
mindnote Mind note
file Regular file

2. Create folder

# 在根目录创建
feishu-cli file mkdir "新文件夹"

# 在指定位置创建
feishu-cli file mkdir "子文件夹" --parent <folder_token>

Output example:

文件夹创建成功!
  名称: 新文件夹
  Token: fldcnAbCdEfGhIjK
  路径: /我的空间/新文件夹

3. Move file or folder

# 移动文档
feishu-cli file move <file_token> --target <folder_token> --type docx

# 移动文件夹
feishu-cli file move <folder_token> --target <parent_folder> --type folder

Parameter description:

Parameter Description Required
file_token Token of the file/folder to move Yes
--target Target folder token Yes
--type File type (docx/sheet/folder/file, etc.) Yes

Output example:

文件移动成功!
  文件: doccnAbCdEfGhIjK
  目标: fldcnXyZaBcDeFgH

4. Copy file

# 复制文档
feishu-cli file copy <file_token> --target <folder_token> --type docx

# 复制并重命名
feishu-cli file copy <file_token> --target <folder_token> --type docx --name "副本"

Parameter description:

Parameter Description Required
file_token Token of the file to copy Yes
--target Target folder token Yes
--type File type Yes
--name New file name No

Output example:

文件复制成功!
  原文件: doccnAbCdEfGhIjK
  新文件: doccnNewCopyToken
  位置: fldcnXyZaBcDeFgH

5. Delete file or folder

# 删除文档
feishu-cli file delete <file_token> --type docx

# 删除文件夹(包含内容)
feishu-cli file delete <folder_token> --type folder

Note: The delete operation moves the file to the trash, where it can be restored within 30 days.

Output example:

文件删除成功!
  文件: doccnAbCdEfGhIjK
  类型: docx

File type reference table

--type parameter Description Example Token
docx New version cloud document doccnXxx
doc Old version cloud document docXxx
sheet Spreadsheet shtcnXxx
bitable Base bitXxx
mindnote Mind note mindXxx
folder Folder fldcnXxx
file Regular file boxcnXxx

Typical workflows

Organize document directories

# 1. 查看当前目录结构
feishu-cli file list

# 2. 创建新文件夹
feishu-cli file mkdir "2024年项目"

# 3. 移动文档到新文件夹
feishu-cli file move doccnXxx --target fldcnXxx --type docx

Back up important documents

# 1. 创建备份文件夹
feishu-cli file mkdir "备份-$(date +%Y%m%d)"

# 2. 复制文档
feishu-cli file copy doccnXxx --target fldcnBackup --type docx --name "文档备份"

Permission requirements

  • drive:drive:readonly - Read file list
  • drive:drive - File operations (create/move/copy/delete)