首页龙虾技能列表 › Batch Renamer — 技能工具

Batch Renamer — 技能工具

v1.0.1

批量文件重命名工具,支持多种命名模式、正则表达式、预览和撤销功能。适用于需要批量整理文件的场景,如照片整理、文档归档、下载文件重命名等。

1· 385·1 当前·1 累计
by @utopiabenben·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/11
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
medium confidence
The skill's code implements a local Python batch renamer (no secrets or network access), but the documentation/instructions contain mismatches (npm install, JavaScript regex) and the implementation has bugs/inconsistencies — review and test before use.
评估建议
This package appears to be a local Python batch-renamer and does not try to exfiltrate data or access secrets — but there are coherence problems you should consider before installing or running it: - Documentation vs implementation mismatch: SKILL.md/README advise 'npm install -g batch-renamer' and state JavaScript regex syntax, while the bundled file is a Python script (batch_renamer.py). Do NOT run npm install unless you intend to install an npm package from the registry; that could fetch unr...
详细分析 ▾
用途与能力
The stated purpose (batch renaming with preview and undo) matches the included Python script: it lists files, generates names, writes a local backup file, renames, and can undo. However the SKILL.md/README recommend npm installation and claim JavaScript regex syntax, which does not cleanly match the Python implementation.
指令范围
SKILL.md instructs npm install -g and describes JavaScript-style regex usage; the actual runtime instructions in the Python script expect running python3 batch_renamer.py. The docs encourage using 's/.../.../' style regexes, and the script attempts to parse that form, but its implementation is incorrect (uses non-existent re.GLOBAL and mixes JS-style expectations with Python re). This is scope/instruction mismatch and can cause surprising failures.
安装机制
No install spec is provided in the skill manifest (instruction-only), but SKILL.md shows an 'npm install -g batch-renamer' command. Because there's no declared install mechanism and the included code is Python, the npm instruction is misleading and could lead users to install an unrelated npm package (which would be a separate security risk).
凭证需求
The skill requests no environment variables, no credentials, and no config paths. Its operations are local file I/O limited to the target directory and a local backup file (.batch-renamer-backup.json), which is proportionate to its stated purpose.
持久化与权限
The skill does not request persistent/global privileges or 'always' inclusion. It stores a backup mapping file in the target directory (expected for undo support) and does not modify other skills or system-wide settings.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.12026/3/6

优化ClawHub描述:应用爆款公式,提升转化率

● 无害

安装命令 点击复制

官方npx clawhub@latest install batch-renamer
镜像加速npx clawhub@latest install batch-renamer --registry https://cn.clawhub-mirror.com

技能文档

功能特性

  • ✅ 多种命名模式:序号、日期、自定义前缀/后缀
  • ✅ 正则表达式支持:灵活匹配和替换
  • ✅ 预览功能:先预览,确认后再执行
  • ✅ 撤销操作:支持撤销最近一次重命名
  • ✅ 安全可靠:自动备份原始文件名

安装

npm install -g batch-renamer

快速开始

1. 序号重命名

batch-renamer rename ./photos --pattern "photo_{001}.jpg"

2. 日期重命名

batch-renamer rename ./docs --pattern "doc_{YYYY-MM-DD}.md"

3. 正则表达式替换

batch-renamer rename ./downloads --regex "s/^DSC_/photo_/"

4. 预览模式(不实际执行)

batch-renamer rename ./photos --pattern "photo_{001}.jpg" --preview

5. 撤销操作

batch-renamer undo ./photos

详细使用说明

命名模式变量

  • {001} - 三位序号(自动补零)
  • {01} - 两位序号
  • {1} - 一位序号
  • {YYYY} - 四位年份
  • {MM} - 两位月份
  • {DD} - 两位日期
  • {HH} - 两位小时
  • {mm} - 两位分钟
  • {original} - 原始文件名(不含扩展名)
  • {ext} - 原始扩展名

正则表达式语法

使用 JavaScript 正则表达式语法:
# 替换前缀
batch-renamer rename ./files --regex "s/^old_/new_/"

# 删除空格 batch-renamer rename ./files --regex "s/\s+/_/g"

# 提取数字 batch-renamer rename ./files --regex "s/.?(\d+)./file_$1/"

安全措施

  • 预览模式:默认先显示预览,需要确认后才执行
  • 自动备份:执行重命名前自动保存映射关系
  • 撤销功能:随时可以撤销最近一次操作
  • dry-run 选项:使用 --preview 或 --dry-run 查看效果

示例场景

场景 1:整理照片

# 将 DSC_0001.jpg 重命名为 2026-03-05_001.jpg
batch-renamer rename ./photos --pattern "{YYYY-MM-DD}_{001}.jpg"

场景 2:整理下载文件

# 将 "下载 (1).pdf" 重命名为 document_001.pdf
batch-renamer rename ./downloads --pattern "document_{001}.{ext}"

场景 3:批量替换

# 将所有文件名中的 "v1" 替换为 "v2"
batch-renamer rename ./files --regex "s/v1/v2/g"

配置文件

可以在项目根目录创建 .batch-renamer.json 配置默认选项:
{
  "preview": true,
  "backup": true,
  "pattern": "{001}.{ext}"
}

故障排除

  • 撤销失败:确保在同一目录下执行,且备份文件未被删除
  • 正则表达式错误:检查语法,可使用 --preview 先测试
  • 权限问题:确保有文件读写权限

更新日志

v0.1.0 (2026-03-05)

  • 初始版本发布
  • 支持基础重命名功能
  • 支持预览和撤销
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务