Back to skills
SKILL.md
Zh
ASecurity基于 glob 通配符模式的批量文件操作(删除、移动、复制、列表)。用于高效文件系统操作的 CLI 工具。零依赖。
- 6 stars
- 0 votes
- 0 copies
- 2 views
- Added September 4, 2026
Works with
Security analysis
100/100npx -y skills add ellmos-ai/skills --skill zh --agent claude-codeAre you the author of Zh?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ellmos-ai-skills-a21b1f99)---
name: batch-file-ops
version: 1.0.0
type: tool
author: Lukas Geiger
created: 2026-03-12
updated: 2026-03-12
description: 基于 glob 通配符模式的批量文件操作(删除、移动、复制、列表)。用于高效文件系统操作的 CLI 工具。零依赖。
standalone: true
anthropic_compatible: true
bach_compatible: true
bach_origin: true
category: utilities
tags: [batch, file-ops, glob, cli, filesystem, cleanup]
language: zh
status: active
dependencies: {'tools': [], 'services': [], 'protocols': [], 'python': []}
provenance: {'origin': 'bach', 'origin_path': 'system/tools/batch_file_ops.py', 'origin_version': '1.0.0', 'origin_repo': 'github.com/ellmos-ai/bach', 'last_sync_from_origin': '2026-03-12', 'last_sync_to_origin': None, 'local_changes_since_sync': False}
---
<img src="../banner.png" width="100%" alt="batch-file-ops banner">
> **中文** — `batch-file-ops` 官方中文版本。
# batch_file_ops - 批量文件操作 (中文)
用于使用 glob 通配符模式对文件执行高效批量操作的 CLI 工具。
支持:delete、move、copy、list。零依赖(仅使用 Python 标准库)。
---
## 操作
| 操作 | 说明 |
|------|------|
| `delete` | 删除符合模式的文件 |
| `move` | 移动符合模式的文件 |
| `copy` | 复制符合模式的文件 |
| `list` | 列出符合模式的文件 |
## CLI 用法
```bash
python batch_file_ops.py <action> <source> [<target>] --pattern "<glob>" [--dry-run] [--recursive]
```
### 参数
| 参数 | 说明 |
|------|------|
| `action` | `delete`、`move`、`copy` 或 `list` |
| `source` | 源目录 |
| `target` | 目标目录(仅适用于 `move` 和 `copy`) |
| `--pattern`, `-p` | Glob 通配符模式(例如 `*.py`、`TOOLS_*.py`)- 默认值:`*` |
| `--dry-run`, `-n` | 仅预览,不应用实际更改 |
| `--recursive`, `-r` | 在子目录中递归搜索 |
---
## 示例与用法
```bash
# 列出目录中的所有 Python 文件
python batch_file_ops.py list /path/to/directory --pattern "*.py"
# 删除所有 .tmp 文件(先使用 dry-run 预览!)
python batch_file_ops.py delete /path/to/directory --pattern "*.tmp" --dry-run
python batch_file_ops.py delete /path/to/directory --pattern "*.tmp"
# 移动文件
python batch_file_ops.py move /source /target --pattern "*.txt"
# 复制文件(递归)
python batch_file_ops.py copy /source /target --pattern "*.md" --recursive
# 模式示例
python batch_file_ops.py delete /path --pattern "TOOLS_*.py"
python batch_file_ops.py list /path --pattern "backup_202?-*"
```
---
## 注意事项
- **先进行空运行(Dry-run):** 在使用 `delete` 和 `move` 时,务必先使用 `--dry-run` 预览
- **Glob 模式:** 使用 Python 的 `pathlib.glob()` / `pathlib.rglob()`
- **兼容 Windows:** 自动使用 UTF-8 输出编码
- **仅限文件:** 自动跳过目录(仅处理文件)
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.