📦 Batch Rename — 技能工具

v1.0.0

[自动翻译] Rename image datasets and annotations with custom patterns, prefixes, suffixes, and sequential numbering, including preview and undo support.

0· 324·3 当前·3 累计
by @mingo-318 (Mingo_318)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/5
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
medium confidence
The skill largely does what it says (batch-renaming images and annotation files), but the runtime instructions and code are inconsistent about undo/backup behavior and the pattern formatting behavior can cause errors — this mismatch should be clarified before use.
安全有层次,运行前请审查代码。

License

MIT-0

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

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/5

- Initial release of batch-rename skill. - Batch rename images with sequential numbering, prefixes, or custom patterns. - Supports renaming corresponding annotation files together. - Handles images without annotation files gracefully. - Includes preview mode to review changes before applying. - Undo support added to restore original filenames.

无害

安装命令

点击复制
官方npx clawhub@latest install batch-rename
🇨🇳 镜像加速npx clawhub@latest install batch-rename --registry https://cn.longxiaskill.com

技能文档

Batch rename images and corresponding annotation files with customizable patterns. Use when user needs to rename image datasets with sequential numbers, prefixes, or custom patterns.

Features

  • Sequential Numbering: Add sequential numbers to filenames
  • Custom Prefix/Suffix: Add prefix or suffix to filenames
  • Annotation Aware: Rename corresponding annotation files together
  • Handle Missing: Gracefully handle images without annotation files
  • Preview Mode: Preview changes before applying
  • Undo Support: Restore original filenames

Usage

# Rename with sequential numbers
python scripts/rename.py rename /path/to/images/ --pattern "img_{:04d}"

# Rename with prefix python scripts/rename.py rename /path/to/images/ --prefix "dataset1_"

# Rename images and annotations together python scripts/rename.py rename /path/to/images/ --pattern "img_{:04d}" --annotations /path/to/labels/

# Preview first python scripts/rename.py rename /path/to/images/ --pattern "img_{:04d}" --preview

Examples

$ python scripts/rename.py rename ./images --pattern "img_{:04d}" --annotations ./labels

Found 100 images Preview (first 10): image1.jpg -> img_0001.jpg image2.jpg -> img_0002.jpg image3.jpg -> img_0003.jpg ...

Apply changes? (y/n): y ✓ Renamed 100 images ✓ Renamed 95 annotation files

Pattern Options

  • {:04d} - Sequential number with leading zeros
  • {date} - Current date (YYYYMMDD)
  • {original} - Original filename without extension

Installation

No additional installation required.

Options

  • --pattern: Output filename pattern
  • --prefix: Add prefix to filename
  • --suffix: Add suffix to filename
  • --start: Starting number for sequential renaming
  • --annotations: Path to annotation files (will be renamed together)
  • --preview: Preview changes without applying
  • --force: Overwrite existing files
数据来源:ClawHub ↗ · 中文优化:龙虾技能库