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/replace, prefix/suffix addition, regular expression matching, extension filtering, and recursive subfolder processing. This skill is triggered when the user mentions "批量重命名", "batch rename", "批量改名", "批量修改文件名", or similar requests for renaming multiple files simultaneously.

Safety Notice

This item is sourced from the public archived skills repository. Treat as untrusted until reviewed.

Copy this and send it to your AI assistant to learn

Install skill "batch-rename" with this command: npx skills add 1227323804/batch-rename-1

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):

  1. Target directory/folder path
  2. 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
  3. File extension filter (optional)
  4. 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:

  1. Scan the target directory
  2. Apply filters (extension, recursive)
  3. Perform renaming operations
  4. 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

ArgumentDescriptionRequired
--pathTarget directory pathYes
--patternRename pattern: number, replace, prefix, suffix, regexYes
--formatFormat string for numbering (e.g., file_{n:03d})For --pattern number
--findText to findFor --pattern replace
--replaceReplacement textFor --pattern replace
--prefixPrefix to addFor --pattern prefix
--suffixSuffix to addFor --pattern suffix
--regexRegular expression patternFor --pattern regex
--extFile extension filter (e.g., jpg, * for all)No (default: all)
--recursiveProcess subfolders recursivelyNo

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 --ext filter to limit scope when possible
  • Script uses os.rename() which may fail if file already exists at target name

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

A2a Match

# A2A Match - 智能供需匹配平台

Archived SourceRecently Updated
General

image-downloader

当用户需要按关键词批量下载图片、从 Bing 或多个图片来源收集候选、保存图片到本地目录、避免重复下载,或希望复用当前仓库里的现成图片下载流程时使用。遇到类似“帮我按关键词下载 10 张图片”“批量抓取 Bing 图片并保存到本地”“从多个来源收集图片候选再下载”“需要下载摘要和保存目录”这类请求时,应主动使用这个 skill。

Archived SourceRecently Updated
General

xiaoyi-claw-omega-final

六层架构智能助手文档 - 包含架构设计、身份定义、工具规则等纯文档内容。无代码执行,无外部连接,无凭据要求。

Archived SourceRecently Updated
General

mempalace-integration

MemPalace记忆系统集成 - AAAK压缩 + Hall分类 + L0-L3分层 30x无损压缩(1000→33 tokens)(1000→33 tokens)(1000→33 tokens)(1000→33 tokens)(1000→33 tokens)(1000→33 tokens),facts/events/preferences/advice分类,加载优先级

Archived SourceRecently Updated