English | 中文
Batch rename the files of a folder, preview first. Config mode (no HTML): electerm draws the form and the result table; main.js only computes names.
This is the built-in File Renamer (src/app/widgets/widget-rename.js) as a user widget, with two safety changes:
- Submitting only builds a plan and shows a table — nothing moves until you press Rename N file(s)
- A row is skipped when the target already exists or two files would land on the same name (the built-in calls
fs.renamedirectly and would silently overwrite)
Settings → Widgets → Import, then paste
electerm/electerm-widget-rename-files
or the full https://github.com/electerm/electerm-widget-rename-files. Import downloads the repo and copies it to <data dir>/widgets/rename-files/.
Repository import needs electerm v5.8.0+. Node built-ins only, no dependency: the repo is package.json + main.js, so there is nothing to install either way. For local development, git clone it and use the Import folder button in the same dialog instead of the URL.
- Folder opens a directory picker (
directoryfield type) - Write the template, look at the preview table
- Confirm Rename N file(s), then read the result table
Template tags:
| Tag | Result |
|---|---|
{name} |
original base name (lowercased when "Keep original case" is off) |
{n} / {n:3} |
counter / padded counter (001) |
{ext} |
extension without the dot |
{date} / {time} |
creation date YYYY-MM-DD / HH-mm-ss |
{random} |
six random characters |
{parent} |
parent folder name |
File types is a comma separated extension list (* for everything); Include subfolders walks recursively.
- A template may not contain path separators or
..— renames cannot leave the chosen folder - The plan is recomputed on apply (same input, same plan); files changed meanwhile show up as skipped/failed
- There is no undo: check the preview, especially for
{n}, which renumbers everything