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
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install batch-rename-1 - After installation, invoke the skill by name or use
/batch-rename-1 - Provide required inputs per the skill's parameter spec and get structured output
What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 117 downloads so far.
How do I install batch-rename?
Run "/install batch-rename-1" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is batch-rename free?
Yes, batch-rename is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does batch-rename support?
batch-rename is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created batch-rename?
It is built and maintained by 1227323804 (@1227323804); the current version is v1.0.0.