← 返回 Skills 市场
1227323804

batch-rename

作者 1227323804 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
117
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install batch-rename-1
功能描述
This skill should be used when the user wants to batch rename multiple files at once. It handles various rename patterns including sequential numbering, find...
使用说明 (SKILL.md)

\r \r

Batch Rename Skill\r

\r

Purpose\r

\r Provides powerful batch file renaming capabilities with multiple pattern support. Rename files with sequential numbers, find/replace text, add prefixes/suffixes, use regex patterns, filter by extension, and process subfolders recursively.\r \r

When to Use\r

\r Use this skill when user wants to:\r

  • Rename multiple files at once (批量重命名)\r
  • Add sequential numbers to filenames\r
  • Find and replace text in filenames\r
  • Add date prefixes or other prefixes/suffixes\r
  • Use regex patterns for complex renaming\r
  • Filter files by extension before renaming\r
  • Process files in subfolders recursively\r \r

Usage Workflow\r

\r

Step 1: Identify User's Rename Intent\r

\r Ask the user (or infer from their request):\r

  1. Target directory/folder path\r
  2. Rename pattern type:\r
    • Sequential numbering: photo_{n}.jpgphoto_001.jpg\r
    • Find & replace: Replace specific text in filenames\r
    • Add prefix/suffix: Add date or other text\r
    • Regex pattern: For complex transformations\r
  3. File extension filter (optional)\r
  4. Whether to process subfolders recursively\r \r

Step 2: Construct Rename Command\r

\r Use the scripts/batch_rename.py script with appropriate arguments:\r \r

# Sequential numbering\r
python scripts/batch_rename.py --path "C:/folder" --pattern "number" --format "file_{n:03d}" --ext "jpg"\r
\r
# Find and replace\r
python scripts/batch_rename.py --path "C:/folder" --pattern "replace" --find "old" --replace "new"\r
\r
# Add prefix\r
python scripts/batch_rename.py --path "C:/folder" --pattern "prefix" --prefix "2026-" --ext "*"\r
\r
# Add suffix\r
python scripts/batch_rename.py --path "C:/folder" --pattern "suffix" --suffix "_backup" --ext "*.txt"\r
\r
# Regex pattern\r
python scripts/batch_rename.py --path "C:/folder" --pattern "regex" --regex "(\d+)" --replace "ID_$1"\r
\r
# Recursive with extension filter\r
python scripts/batch_rename.py --path "C:/folder" --pattern "number" --format "doc_{n}" --ext "pdf" --recursive\r
```\r
\r
### Step 3: Execute Rename\r
\r
Run the command. The script will:\r
1. Scan the target directory\r
2. Apply filters (extension, recursive)\r
3. Perform renaming operations\r
4. Report results\r
\r
### Step 4: Report Results\r
\r
Present a summary showing:\r
- Number of files renamed successfully\r
- Any errors or skipped files\r
- Original → New name mappings for verification\r
\r
## Script Arguments Reference\r
\r
| Argument | Description | Required |\r
|----------|-------------|----------|\r
| `--path` | Target directory path | Yes |\r
| `--pattern` | Rename pattern: `number`, `replace`, `prefix`, `suffix`, `regex` | Yes |\r
| `--format` | Format string for numbering (e.g., `file_{n:03d}`) | For `--pattern number` |\r
| `--find` | Text to find | For `--pattern replace` |\r
| `--replace` | Replacement text | For `--pattern replace` |\r
| `--prefix` | Prefix to add | For `--pattern prefix` |\r
| `--suffix` | Suffix to add | For `--pattern suffix` |\r
| `--regex` | Regular expression pattern | For `--pattern regex` |\r
| `--ext` | File extension filter (e.g., `jpg`, `*` for all) | No (default: all) |\r
| `--recursive` | Process subfolders recursively | No |\r
\r
## Examples\r
\r
### Example 1: Add Sequential Numbers\r
```\r
User: "把 photos 文件夹里的图片重命名为 IMG_001, IMG_002..."\r
Command: python scripts/batch_rename.py --path "C:/Users/12891/photos" --pattern number --format "IMG_{n:03d}" --ext "jpg"\r
```\r
\r
### Example 2: Find and Replace\r
```\r
User: "把所有文件名里的 '_v1' 改成 '_final'"\r
Command: python scripts/batch_rename.py --path "C:/folder" --pattern replace --find "_v1" --replace "_final"\r
```\r
\r
### Example 3: Add Date Prefix\r
```\r
User: "给所有文档加上日期前缀 2026-04-10"\r
Command: python scripts/batch_rename.py --path "C:/docs" --pattern prefix --prefix "2026-04-10_" --ext "docx"\r
```\r
\r
### Example 4: Regex to Normalize\r
```\r
User: "把所有文件名的空格替换成下划线"\r
Command: python scripts/batch_rename.py --path "C:/folder" --pattern regex --regex "\s+" --replace "_"\r
```\r
\r
## Safety Notes\r
\r
- Always report what will be renamed before executing\r
- For subfolder operations, be extra careful and confirm the scope\r
- Use `--ext` filter to limit scope when possible\r
- Script uses `os.rename()` which may fail if file already exists at target name\r
安全使用建议
This skill appears to implement a legitimate batch-rename tool and does not request credentials or network access. However: 1) Make a backup before running this on important files — the script uses os.rename() and will change files in place. 2) The SKILL.md suggests preview/confirmation but the script has no --dry-run or interactive confirm; ask the author to add a dry-run flag (or manually check file lists) before executing. 3) Use the --ext argument as a bare extension (e.g., --ext jpg or --ext .txt) rather than wildcard patterns like "*.txt" (the examples in the docs are misleading). 4) Test on a small sample directory first to verify the pattern, recursion, and collision behavior. 5) If you want autonomous invocation by an agent, ensure the agent will request explicit user confirmation before running the rename to avoid accidental mass edits.
功能分析
Type: OpenClaw Skill Name: batch-rename-1 Version: 1.0.0 The skill is a standard utility for batch renaming files using patterns like sequential numbering, find/replace, and regex. The implementation in `scripts/batch_rename.py` uses standard Python libraries (os, re, argparse) and includes appropriate safety checks, such as verifying the existence of target paths before renaming. No indicators of data exfiltration, malicious execution, or prompt injection were found.
能力评估
Purpose & Capability
Name/description match the delivered code: the Python script implements sequential numbering, find/replace, prefix/suffix, regex, extension filtering, and recursion as advertised. Minor mismatch: SKILL.md demonstrates wildcard ext values like "*.txt", but the script expects either '*' or a bare extension (e.g., 'txt' or '.txt'), so some example usages in the docs are misleading.
Instruction Scope
SKILL.md instructs the agent to 'report what will be renamed before executing' and to confirm scope for recursive operations, but the script provides no explicit dry-run/preview mode or interactive confirmation: it prints counts and then performs renames, printing each change as it happens. This increases the risk of unintended mass changes if the agent runs the script without a manual review step.
Install Mechanism
No install spec and no external packages or network fetches. The script is pure Python using stdlib modules; nothing is written to disk beyond normal file renames performed by the script itself.
Credentials
The skill requests no environment variables, credentials, or config paths — requirements are proportionate to its stated purpose.
Persistence & Privilege
always is false and the skill does not modify other skills or require permanent presence. It performs local filesystem operations only when invoked.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install batch-rename-1
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /batch-rename-1 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Major update with expanded batch renaming capabilities and pattern support. - Added new script (scripts/batch_rename.py) supporting sequential numbering, find/replace, prefix/suffix, regex, extension filtering, and recursive folder processing. - Enhanced documentation with detailed usage guides, argument references, workflow steps, and safety notes. - Removed old script and test files related to previous image and annotation renaming workflow. - Skill now responds to a wider variety of batch rename requests, including multi-language triggers.
元数据
Slug batch-rename-1
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

batch-rename 是什么?

This skill should be used when the user wants to batch rename multiple files at once. It handles various rename patterns including sequential numbering, find... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 117 次。

如何安装 batch-rename?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install batch-rename-1」即可一键安装,无需额外配置。

batch-rename 是免费的吗?

是的,batch-rename 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

batch-rename 支持哪些平台?

batch-rename 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 batch-rename?

由 1227323804(@1227323804)开发并维护,当前版本 v1.0.0。

💬 留言讨论