Skip to content
Automation
Skill

/get_files

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

BOOST
From plugin
python-office
1.4k74 skills
Install
$ npx -y skills add coderwanfeng/python-office --skill get_files --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/get_files

Context preview

The summary Claude sees to decide when to auto-load this skill.

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

SKILL.md

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

get_files Skill

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

功能描述

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

所属分类

`office/skills/file/get_files/`

调用方式

from skills.file import get_files

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

参数说明

| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | `path` | str | 是 | - | 路径 | | `name` | str | 否 | `''` | 文件名 | | `suffix` | str | 否 | `None` | 文件后缀 | | `sub` | bool | 否 | `False` | 是否搜索子目录 | | `level` | int | 否 | `0` | 搜索层级 |

返回值

`list`:文件路径列表

使用示例

from 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`

Ships withpython-office

pip install python-office 自动化办公专用库

Get the whole plugin
Stats
1,358
Stars
303
Forks
Maintained
Maintenance
Python
Language
Apache-2.0
License
1mo ago
Last commit
4y ago
Created
1d ago
Added

Repo: coderwanfeng/python-office

Other skills on python-office.