OpenParable
Skip to content
← Back to skills

Get Files

Documents
get_files

Get Files is an Agent Skill for documents published in the CoderWanFeng/python-office repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

在指定路径下搜索文件并返回路径列表,支持按后缀、子目录、层级过滤。当用户提到获取文件列表、查找某类文件、列出所有文件时使用。

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/CoderWanFeng/python-office/blob/HEAD/skills/file/get_files/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/get-files, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

get_files Skill

搜索当前路径下所有指定类型的文件,并以列表形式返回

功能描述

在指定路径下搜索文件,支持按文件名、后缀、子目录等条件过滤,返回文件路径列表。

所属分类

office/skills/file/get_files/

调用方式

from office.skills.file import get_files

files = get_files(
    path='./data',
    name='report',
    suffix='.txt',
    sub=False,
    level=0
)

参数说明

参数类型必填默认值说明
pathstr是-路径
namestr否''文件名
suffixstr否None文件后缀
subbool否False是否搜索子目录
levelint否0搜索层级

返回值

list:文件路径列表

使用示例

from office.skills.file import get_files
# 获取所有 .txt 文件
txt_files = get_files(path='./docs', suffix='.txt', sub=True)
# 获取所有名为 report 的文件
reports = get_files(path='./data', name='report', sub=True)

原始函数

office.api.file.get_files