Blog

Automation

How to batch rename files on Mac, Windows and Linux

Finder, File Explorer and PowerShell all batch rename for free. What each one can do, where the counter trap bites, and when a file needs its own name.

Key insights

  • Select-and-rename in Finder or File Explorer gives every file one shared name plus a counter, and nothing else changes.
  • Your Mac ships replace, add and format modes in Finder, while Windows needs PowerShell for anything beyond numbering.
  • Renaming 40 files by hand costs you about two minutes, and 400 files costs you an afternoon.
  • A counter carries no information about what is inside a file, so a sequential rename organizes nothing.

What batch renaming can and can't do

Batch renaming applies one change to many files at once, and every desktop operating system ships a way to do it free. You can replace text across 300 filenames, add a prefix to all of them, or hand the whole set one name plus a counter, without installing anything.

The terms all describe the same operation. Batch rename, bulk rename, mass rename, and rename multiple files at once are one feature with four names, so you already have it whichever phrase you searched.

What the built-ins cannot do is give each file its own meaningful name. One pattern is applied to every file equally, and that constraint follows you from Finder to PowerShell to dedicated renaming applications. Keep it in mind as you pick a method below. The good news is the built-ins reach further than most people use, and you should exhaust them before paying for anything.

On Mac: Finder's built-in rename

Finder hides a real batch renamer behind the right click. Select your files, Control-click the selection, choose Rename, and a small dialog offers three modes. Apple walks through the same steps in its official rename documentation, and everything below was tested on macOS 26.

Replace text

Replace text swaps a fragment in every selected name. Take 60 files shaped like Screenshot 2026-06-10 at 9.14.22.png, replace "Screenshot" with "checkout-flow", and you get checkout-flow 2026-06-10 at 9.14.22.png across the whole set in under a second.

Add text

Add text appends or prepends a fixed string. Prefix 80 camera exports with kyoto- and IMG_4827.JPG becomes kyoto-IMG_4827.JPG. Use it when the old name still carries something you want to keep.

Format: name plus counter

Format throws the old names away. Pick Name and Index, type a base name of your choice, and 400 selected files leave as Invoice 1.pdf through Invoice 400.pdf. The dialog also offers Name and Counter and Name and Date, and you can set the starting number, which matters when you add a second batch to an existing set. Remember the counter output, because it returns in the ceiling section below.

Changed your mind halfway? Cmd+Z in Finder undoes the entire batch in one step, which makes the Mac dialog a safe place to experiment. If the same rename repeats every week, the folder side of that job belongs to rules, and Mac users usually reach for automating file rules on your Mac instead of repeating the dialog. A rule renames every new arrival for you, forever.

On Windows: File Explorer and PowerShell

The select-and-rename method

File Explorer batch renames with a single input. Select the files, press F2, type one name, press Enter, and Windows produces scan (1).pdf, scan (2).pdf and so on down the list. You get numbering in parentheses and no other options.

That is the whole feature. No replace, no prefix, no date insertion, which is why you hit the built-in wall sooner on Windows 11 than on a Mac.

PowerShell Rename-Item with patterns

PowerShell removes that wall. The Rename-Item cmdlet accepts a script block, so you can rewrite names with a regular expression, a pattern language for matching text, across thousands of files in one line.

Get-ChildItem *.jpg | Rename-Item -NewName { $_.Name -replace '^IMG_', 'kyoto-2026_' }

The command collects every .jpg in the folder and rewrites the prefix, so IMG_4827.jpg leaves as kyoto-2026_4827.jpg. Microsoft documents the script block form in the Rename-Item reference, and you can preview any rename by adding -WhatIf before committing.

Case cleanup uses the same script block. The case-sensitive variant -creplace turns your camera dump of .JPG endings into tidy lowercase:

Get-ChildItem *.JPG | Rename-Item -NewName { $_.Name -creplace '\.JPG$', '.jpg' }
No undo in the shell

PowerShell and the Linux rename command apply changes instantly and keep no history. Run the command with -WhatIf first, or test on a copied folder, before you point it at 400 real files.

Time cost is where the shell earns its keep. 40 files renamed by hand costs you two minutes and a little patience. 400 files by hand is an afternoon you will not finish, while the PowerShell line above processes the same folder in under a second.

On Linux: rename and mv

Linux gives you the same two levels in the terminal. The rename utility applies a pattern across many files, and on Debian and Ubuntu it takes a Perl expression:

rename 's/^IMG_/kyoto-2026_/' *.jpg

Check which variant you have first, because the util-linux version shipped by Fedora and Arch expects plain text pairs instead of expressions. Add -n to the Perl variant and it prints every rename without applying them, your closest thing to a preview here. For one-off structural changes, a shell loop with mv covers you:

for f in *.jpeg
do
  mv "$f" "${f%.jpeg}.jpg"
done

That loop swaps every .jpeg extension for .jpg and leaves the rest of each name exactly as you had it.

Which built-in wins overall? Take IMG_4827.JPG as the before. Finder's Replace text gets you kyoto-4827.JPG, File Explorer's F2 trick gets you kyoto (212).JPG, and the PowerShell or Perl expression gets you kyoto-2026_4827.JPG. Same file, three ceilings, summarized below.

Method Can do Cannot do Realistic ceiling
Finder rename (Mac) Replace text, add text, name plus counter or date Regex, conditions, per-file names Thousands of files, one pattern per pass
File Explorer (Windows) One name plus automatic numbering Replace, prefix, any formatting control Any count, but only numbered clones
PowerShell and shell tools Regex rewrites, extension swaps, previews Names based on file contents Tens of thousands of files per run

The counter problem

Run the Format trick on a real folder and study what you get back. 400 mixed downloads went in, Invoice 1.pdf through Invoice 400.pdf came out, and the one contract you need this afternoon is indistinguishable from 399 other files. The old names were messy, but meridian_statement_mar.pdf told you something.

Sequential batch renaming gives every file the same name plus a counter. That is a valid operation and occasionally the right one. But if you needed to be able to find a specific file afterwards, you have made the problem worse, not better. The counter carries no information about what is in the file.

That limit follows you into every tool built on the same inputs, because a pattern can only rearrange what the filename, path or metadata already contain. It is exactly the line between pattern-based and content-based renaming.

Renaming by what's in the file instead

The names you actually want usually live inside the files. The vendor on an invoice, the client in a contract, the date a statement covers. No pattern reaches them, because none of that text sits in the filename, the path or the metadata your renamer can see.

Content-based renaming reads the document first. The software opens each file, extracts the fields that identify it, vendor, document date, document number, type, and builds a filename from them using a pattern you define once. scan_0087.pdf comes back as 2026-05-11_Delta-Freight_INV-2201.pdf without you typing either value.

The time budget flips at the same point. Opening 400 mixed downloads one by one just to learn what they are costs you hours before the first rename happens. An extraction pass does that reading in minutes and hands you the names to approve, and the math only improves as folders grow.

Does that replace the built-ins? Not for uniform sets. Your photo series, a podcast season or a folder of exports with one shared shape is still a job for Finder or the PowerShell line above, finished in seconds at zero cost. Extraction is for the folders where every file needs its own answer.

Two safeguards matter at that level, because a wrong automated name is worse than a messy one. You want a review step that shows every proposed name before it is applied, and an undo that restores the batch when a result surprises you. Scanned documents add one requirement of their own, an OCR pass, optical character recognition, since a scan is a picture of text rather than text a program can read.

The two levels also work in sequence. You can normalize extensions and strip prefixes with the patterns above, then let extraction handle the naming layer patterns cannot reach. Nothing about choosing one rules out the other, and the cheap pass often shrinks the expensive one.

For PDFs specifically, the guide to renaming PDFs based on their contents covers extraction fields, output patterns and the scan workflow end to end. It is the next step once your problem stops being "rename these files" and becomes "name these files after what they are". Start there if your backlog is mostly paperwork, because paperwork is where the counter hurts most.

FAQ

How do you batch rename files with different names?

Built-in tools cannot do it, since they apply one pattern to every file. You need either a script that reads target names from a list you prepare, or content-based renaming software that derives each name from the file itself.

Can you undo a batch rename?

In Finder, one Cmd+Z reverses the whole batch. In File Explorer, Ctrl+Z reverses one file per press, so a 400-file mistake takes you 400 presses. Shell commands offer no undo at all, which is why a preview flag or a test folder comes first.

What's the maximum number of files you can rename at once?

Neither Finder nor File Explorer publishes a hard limit, and both handle a few thousand files in practice before the selection itself becomes your bottleneck. PowerShell and the Linux tools go far beyond that, since they stream through the list instead of loading a selection into a dialog.

How do you batch rename files without third-party software?

Everything on this page runs on a clean install. Use the Rename dialog in Finder, F2 numbering in File Explorer, Rename-Item in PowerShell, or the rename and mv commands on Linux, and you never download a thing.

Pick the smallest tool that finishes the job

You now have the Finder dialog with its three pattern modes, F2 numbering on Windows plus Rename-Item for regex-scale rewrites, the terminal pair on Linux, and the counter trap that decides when patterns stop being the answer. Match the tool to whether your files share one shape or need individual names, and ten minutes with the right built-in usually beats an hour with the wrong download.

Still deciding whether this fits how you work? The related guides below go deeper, or you can see how Nymos handles it.