# Rename multiple files at once to a clean pattern

> Markdown version of https://stella.sh/how/files-folders/rename-multiple-files-at-once for agents and LLMs.
> Bulk rename messy files to one pattern like “01 - Cells.pdf” so they sort right: Finder's Rename, PowerToys PowerRename, or Stella (stella.sh) reading each file.

On a Mac, select the files, Control-click and choose Rename to replace text or add numbers. On Windows, the free Microsoft PowerToys adds PowerRename, which takes find-and-replace patterns. Neither can add a leading zero to a number that's already in the name, or read a file to find the number that's missing from its name. Stella (stella.sh) renames to the pattern you describe in words, reading inside the files when the name isn't enough.

- Checked: 13 November 2026
- Stella does it on: Windows, Mac, Linux

## Stella doing it

Recorded 13 November 2026 on Linux (Omarchy) with Claude Code with Opus, on a Claude plan.
Result: All 14 renamed in about 15 seconds. Checked afterwards against an answer key written before the run, by file contents: every file is named `NN - Topic.pdf` with its correct lecture number (including 09, not 101, for `BIO101 L9 Inheritance.pdf`, and 13 and 14 for the two without numbers), renamed not copied, with lower-case `.pdf` and nothing else added to the folder. The lecture PDFs were made for this run. Stella's first message is a terse working note (“Titles match filenames and are clean; renaming.”) rather than its usual plan. The run isn't sped up.

Video (32 s): https://stella.sh/media/proofs/files-folders/rename-multiple-files-at-once/proof.mp4

Transcript:

- 0:00 Stella on a Linux computer. 14 lecture PDFs with messy names are in Documents/Biology 101.
- 0:02 The prompt: rename them like '01 - Cells.pdf', two-digit number, dash, topic.
- 0:15 A short working note: the titles inside match the file names.
- 0:18 Done: 01 - Cells to 14 - Revision, with lectures 13 and 14 numbered from the titles inside the files.

What Stella does:

1. Opens the Biology 101 folder: 14 PDFs named like `Lec 2 Membranes (final).pdf`, `lecture10_genetics.PDF` and `Plant hormones.pdf`
2. Reads the title inside each PDF, such as “Lecture 13: Plant hormones”, and checks it against the number in the file name
3. Uses the inside title for the two files with no number in their names
4. Renames all 14 to `NN - Topic.pdf`, dropping leftovers like “v2”, “(final)” and “(1)” and making `.PDF` lower case
5. Lists the new names in order

## The prompt to paste

```text
The lecture slides in the Biology 101 folder in my Documents have messy names and sort in the wrong order. Rename them all like '01 - Cells.pdf': the two-digit lecture number, a dash, then the topic.
```

## Rename them yourself

1. **Mac: Finder's Rename.** Select the files, Control-click and choose Rename… Use Replace Text to remove words like `Lecture `, `_` and ` v2` one at a time. Format can number files, but only in the order Finder shows them, not by the number in the name.
2. **Windows: PowerToys PowerRename.** Install Microsoft PowerToys (free), turn on PowerRename, select the files, right-click and choose Rename with PowerRename. Tick “Use regular expressions” to pull out the number and topic, and preview the new names before applying.
3. **Add the leading zeros.** `2` sorts after `10` unless it's written `02`. In PowerRename, do a second pass on the single-digit names (search `^(\d) - ` and replace with `0$1 - `). In Finder, fix those few by hand.
4. **Open the files with no number.** A file called `Plant hormones.pdf` gives no clue to its lecture number. Open it, read the title, and rename it by hand.
5. **Keep a list of old names.** Before renaming a big batch, take a screenshot of the folder or copy the names into a note. Neither tool keeps an undo list once you close it.

## Where Stella stops

- When names depend on what's inside, Stella opens each file. For scans, that means text recognition, which is slower.
- It doesn't keep a list of old and new names unless you ask; add “keep a list of the old names” to the prompt if you want an undo record.
- The first lines of each PDF go to the AI model you use in Stella so it can read the titles. The renaming happens on your computer.
- Recorded on Linux. On a Mac or Windows PC Stella may install a small PDF-reading library first, which wasn't recorded.

## Questions

**Why do my files sort 1, 10, 11, 2?**
Some apps sort names letter by letter, so `10` comes before `2`. Two-digit numbers (`01`, `02` … `10`) sort right everywhere.

**Can it rename files based on what's inside them?**
Yes. Here it read lecture titles; for invoices, statements and letters see [rename PDFs by their content](https://stella.sh/how/photos-files/rename-pdf-files-based-on-content).

**Can I undo a bulk rename?**
Windows' Ctrl+Z undoes a PowerRename batch right after. Otherwise you need a list of old names, so ask Stella to save one next to the files.

**Can it rename and gather files from subfolders at once?**
Yes, in one prompt. See [move files from subfolders into one folder](https://stella.sh/how/files-folders/move-files-from-subfolders-into-one-folder), where Stella put each old folder name into the new file name.

**Is Stella free for this?**
Yes. Free with the ChatGPT or Claude plan you already have. Sign in with your ChatGPT plan, or use your Claude plan through Claude Code, and this task costs nothing extra. New accounts also get a small free trial of Stella’s own models.

**Can I control what Stella changes on my computer?**
Yes. Stella works on Windows, Mac and Linux with your own files and shows each step in the chat, so you can watch it and stop it at any point. Tell it what it may not do, as the prompts on these pages do (“don't delete anything without asking”). In the Downloads recording it deleted nothing until it was told to go ahead. It also refuses commands that would wipe a whole disk, your home folder or system folders.

Sources: [Apple: Rename files, folders and disks on Mac](https://support.apple.com/guide/mac-help/mchlp1144/mac), [Microsoft Learn: PowerToys PowerRename](https://learn.microsoft.com/windows/powertoys/powerrename).

## Related problems

- [Rename PDF files based on their content](https://stella.sh/how/photos-files/rename-pdf-files-based-on-content.md)
- [Move all files from subfolders into one folder without losing any](https://stella.sh/how/files-folders/move-files-from-subfolders-into-one-folder.md)
- [Find files containing text, whatever type of file they are](https://stella.sh/how/files-folders/find-files-containing-text.md)
- [Extract multiple zip files at once, each into its own folder](https://stella.sh/how/files-folders/extract-multiple-zip-files-at-once.md)
- [How to open a 7z file, even one split into parts](https://stella.sh/how/files-folders/open-7z-file.md)
- [How to open a RAR file on a Mac or Windows PC](https://stella.sh/how/files-folders/open-rar-file.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT or Claude plan you already have.
