batch-rename
/install batch-rename-1
\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
- Target directory/folder path\r
- Rename pattern type:\r
- Sequential numbering:
photo_{n}.jpg→photo_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
- Sequential numbering:
- File extension filter (optional)\r
- 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
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install batch-rename-1 - 安装完成后,直接呼叫该 Skill 的名称或使用
/batch-rename-1触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
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。