Skills batch-rename
install
source · Clone the upstream repo
git clone https://github.com/openclaw/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/1227323804/batch-rename-1" ~/.claude/skills/openclaw-skills-batch-rename && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/openclaw/skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/1227323804/batch-rename-1" ~/.openclaw/skills/openclaw-skills-batch-rename && rm -rf "$T"
manifest:
skills/1227323804/batch-rename-1/SKILL.mdsource content
Batch Rename Skill
Purpose
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.
When to Use
Use this skill when user wants to:
- Rename multiple files at once (批量重命名)
- Add sequential numbers to filenames
- Find and replace text in filenames
- Add date prefixes or other prefixes/suffixes
- Use regex patterns for complex renaming
- Filter files by extension before renaming
- Process files in subfolders recursively
Usage Workflow
Step 1: Identify User's Rename Intent
Ask the user (or infer from their request):
- Target directory/folder path
- Rename pattern type:
- Sequential numbering:
→photo_{n}.jpgphoto_001.jpg - Find & replace: Replace specific text in filenames
- Add prefix/suffix: Add date or other text
- Regex pattern: For complex transformations
- Sequential numbering:
- File extension filter (optional)
- Whether to process subfolders recursively
Step 2: Construct Rename Command
Use the
scripts/batch_rename.py script with appropriate arguments:
# Sequential numbering python scripts/batch_rename.py --path "C:/folder" --pattern "number" --format "file_{n:03d}" --ext "jpg" # Find and replace python scripts/batch_rename.py --path "C:/folder" --pattern "replace" --find "old" --replace "new" # Add prefix python scripts/batch_rename.py --path "C:/folder" --pattern "prefix" --prefix "2026-" --ext "*" # Add suffix python scripts/batch_rename.py --path "C:/folder" --pattern "suffix" --suffix "_backup" --ext "*.txt" # Regex pattern python scripts/batch_rename.py --path "C:/folder" --pattern "regex" --regex "(\d+)" --replace "ID_$1" # Recursive with extension filter python scripts/batch_rename.py --path "C:/folder" --pattern "number" --format "doc_{n}" --ext "pdf" --recursive
Step 3: Execute Rename
Run the command. The script will:
- Scan the target directory
- Apply filters (extension, recursive)
- Perform renaming operations
- Report results
Step 4: Report Results
Present a summary showing:
- Number of files renamed successfully
- Any errors or skipped files
- Original → New name mappings for verification
Script Arguments Reference
| Argument | Description | Required |
|---|---|---|
| Target directory path | Yes |
| Rename pattern: , , , , | Yes |
| Format string for numbering (e.g., ) | For |
| Text to find | For |
| Replacement text | For |
| Prefix to add | For |
| Suffix to add | For |
| Regular expression pattern | For |
| File extension filter (e.g., , for all) | No (default: all) |
| Process subfolders recursively | No |
Examples
Example 1: Add Sequential Numbers
User: "把 photos 文件夹里的图片重命名为 IMG_001, IMG_002..." Command: python scripts/batch_rename.py --path "C:/Users/12891/photos" --pattern number --format "IMG_{n:03d}" --ext "jpg"
Example 2: Find and Replace
User: "把所有文件名里的 '_v1' 改成 '_final'" Command: python scripts/batch_rename.py --path "C:/folder" --pattern replace --find "_v1" --replace "_final"
Example 3: Add Date Prefix
User: "给所有文档加上日期前缀 2026-04-10" Command: python scripts/batch_rename.py --path "C:/docs" --pattern prefix --prefix "2026-04-10_" --ext "docx"
Example 4: Regex to Normalize
User: "把所有文件名的空格替换成下划线" Command: python scripts/batch_rename.py --path "C:/folder" --pattern regex --regex "\s+" --replace "_"
Safety Notes
- Always report what will be renamed before executing
- For subfolder operations, be extra careful and confirm the scope
- Use
filter to limit scope when possible--ext - Script uses
which may fail if file already exists at target nameos.rename()