Batch File Renamer
Rename thousands of files with templates and numbering, preview every row, auto-resolve collisions, then download a ZIP or a rename script
改名、打包、生成脚本都在浏览器本地完成,文件内容不会被上传
About this tool
Renaming a batch is rarely hard because of one file; it is hard because two files end up with the same name, an extension gets eaten, or nobody remembers what the originals were called. This tool turns renaming into a rule you can inspect row by row: drop the files in, adjust the template and see every new name before anything is written.
- Name template:
{name}for the base name,{n}for the sequence number,{ext}for the extension,{date}for today,{time}for the current time,{mtime}for the file's modified date and{size}for its size; common templates are one-click buttons - Sequence controls: start, step and zero padding are set separately, so a start of 10, a step of 5 and four digits give
0010 / 0015 / 0020; switching a row off takes it out of the numbering and later rows move up - Regex find and replace: with regex on,
$1and$2back-references work, so^(\w+)\s(\d+)replaced with$2_$1turns "DSC 0421" into "0421_DSC"; a bad pattern flags the row and keeps the original name instead of blanking the column - Case and cleanup: the base name can go lower case, upper case, sentence case or title case; spaces can become -, _ or nothing; characters such as \ / : * ? " < > | are stripped by default, repeated separators collapse, leading and trailing dots and spaces are trimmed, and reserved Windows names such as CON, NUL and LPT1 get an underscore prefix
- Four extension modes: keep, lower case, upper case or force a specific one. If
{ext}appears in the template it is placed exactly where you put it; otherwise the original extension is reattached automatically so renamed files still open - Collision handling: when a new name is taken, the tool appends
(2)and(3), or you can choose to keep the original name; names that differ only in case count as collisions because Windows and macOS are case-insensitive by default - Per-row edits and exclusions: any row in the preview can be edited by hand; a hand-edited row stops following later rule changes, and a restore button puts it back. Rows you do not want to touch can be excluded, and a row can be removed entirely
- Sort decides the numbering: order by insertion, name, size or modified time before numbering. Sort by modified time newest first, then apply
{n}, and you get a sequence in shooting order - Three ways to finish: download a ZIP of the renamed copies, flat or preserving the original folders; copy the list of new names; or copy an original to new name mapping for your records
- Rename scripts: PowerShell, batch and Shell output, with one
Rename-Item,renormv -nper file and quoting handled. Copy the script into the target folder and run it
Why a script as well
A browser cannot rename files on your disk for security reasons, so the ZIP is a set of copies with new names. To rename in place, the generated script is the safer route: it only changes names, leaves contents, permissions and timestamps alone, and never loads gigabytes of files into memory.
When to use it
- Phone exports full of names like
IMG_2043 copy (1).JPGthat you want in shooting order asIMG_0001 - Downloads with spaces and brackets that break on a server or in Git and need safe characters
- Meeting recordings or interview transcripts filed as date plus number so they line up with notes
- Scans named
scan0001.pdfthat should read likecontract-20261020-01.pdf - A folder where some images end in
.JPGand others in.jpg, breaking case-sensitive web references - One batch renamed to a shared prefix with continuous numbers, plus a mapping table for later reference
Template cheat sheet
| Goal | Template | Settings | Result |
|---|---|---|---|
| Numbered photos | IMG_{n} | 4 digits | IMG_0001.JPG |
| Group by shooting date | {mtime}_{n} | 3 digits, sorted by modified time | 20260511_001.JPG |
| Only clean spaces and symbols | {name} | Spaces to -, strip illegal characters | DSC-0421-copy.JPG |
| Everything lower case | {name} | Lower case base and extension | photo.png |
| Drop the camera prefix | {name} | Regex find ^DSC\s*, replace with nothing | 0421.jpg |
| Scans by date | scan_{date}_{n} | 2 digits, lower case extension | scan_20261020_01.pdf |
Common questions
- Can it damage files?No. Rules only touch names; the ZIP is built from the original bytes, and the page never writes to your disk
- How many files at once?Up to 2000. The preview draws the first 400 rows, but numbering, collision handling, scripts and the ZIP cover all of them
- Why is the ZIP stored without compression?Photos, video and installers are already compressed, so a second pass saves little and costs time. Stored entries are faster and avoid large memory use in the browser. If a single file or the total approaches 4GB the tool refuses and suggests the script instead
- Does dropping a folder keep its structure?The default is flat in the ZIP root, with collisions resolved automatically; choose the folder-preserving option to keep the original layout
- What should I watch in the scripts?The script contains bare filenames, so run it from the folder that holds the files. Batch
renstops on a name clash, whilemv -nskips instead of overwriting. Try it on a copy the first time - How are dotfiles treated?A name like
.gitignorecounts as having no extension, and the leading dot is preserved rather than becoming an empty base name - Can the extension get lost?It is reattached by default. Only two cases are yours to manage: the template contains
{ext}, or the replace-extensions option is on, in which case the whole name goes through replacement and nothing is appended - Can I rename only some file types?Switch off the rename toggle on the rows you want to leave alone, or sort by name or modified time first so similar files sit together
- Is anything uploaded?No. Reading, rule evaluation, zipping and script generation all happen in the browser; no request is sent and a refresh clears everything
To inspect files before renaming, use the file info reader; for a plain list of names, use the filename extractor; to split base names from extensions or change extension case on its own, use the filename and extension splitter and the extension case converter; to confirm renamed copies match the originals, run them through the file hash tool; to build matching folders, use the folder batch creator.