gizmobench
BrowseDaily
← All guides

GizmoBench guides

How to Batch Rename Files on Windows, Mac and Drive

GizmoBench ·

To batch rename files, select them all in your file manager, press F2 on Windows (or Control-click and choose Rename on a Mac), and enter one shared base name. The system numbers the files for you. That covers the most common job, a folder of camera photos. For find-and-replace, pattern-based or repeatable renames, you need a more capable tool: PowerRename on Windows, Finder’s Replace Text on Mac, or a short PowerShell command. This guide compares those options by the kind of change you are making, and ends with a preview-first routine that prevents most renaming accidents.

One scope note up front. GizmoBench does not have a dedicated file renamer, and we would rather say so than imply otherwise. What we do have are browser tools that make the hard part of renaming, writing and checking the pattern, easier, and they are covered in the relevant sections below.

GizmoBench
Check Your Rename Pattern Before Applying
Use GizmoBench’s browser tools to write and check a file-renaming pattern, then apply it with your file manager or renaming utility.

TL;DR

  • One shared name plus numbers: select the files, press F2 in Windows File Explorer, type the base name, press Enter. Windows Central documents that Explorer keeps each extension and appends a number in parentheses.
  • Find and replace, or regex: use Microsoft PowerRename, which shows a preview before it applies anything and supports undo.
  • Mac: Finder offers Replace Text, Add Text and Format (name plus counter or date), according to Apple’s instructions.
  • Repeatable rules: PowerShell’s Rename-Item, fed by Get-ChildItem, handles the same rule on thousands of files.
  • Always: test on a few copies, read the preview, and leave extensions alone unless you mean to change the file type.

Table of Contents

Choose the method by the kind of change

Batch renaming is a form of batch processing: one rule applied to many files (Wikipedia’s overview describes it that way). The rule is what matters, so start by classifying yours. Most jobs fall into one of five types:

  1. Give everything the same name plus a sequence number (IMG_4021.jpg becomes Trip 1.jpg, Trip 2.jpg).
  2. Replace a piece of text (swap IMG_ for Paris_, or remove “copy of”).
  3. Add a prefix, suffix or date to existing names.
  4. Change by pattern (reorder parts of a name, strip digits, change case).
  5. Repeat the same rule regularly, for example every week’s exports.

The table below maps each type to the built-in option that fits it. These are capability-based recommendations drawn from the vendors’ own documentation, not a universal ranking of products.

Job Windows Mac Cloud (Google Drive)
Shared name + numbering File Explorer (F2) Finder, Format option Rename one item at a time
Replace text PowerRename Finder, Replace Text Not documented as a batch feature
Add prefix, suffix or date PowerRename or PowerShell Finder, Add Text or Format Not documented as a batch feature
Regex or pattern logic PowerRename or PowerShell Terminal scripts (outside this guide) Download, rename locally, re-upload
Repeatable rule PowerShell or Command Prompt Terminal scripts Not applicable

Windows File Explorer: one base name, automatic numbers

This is the fastest method and needs no installation. Per Windows Central’s walkthrough:

  1. Open the folder and select the files (Ctrl+A for all, or Ctrl-click to pick).
  2. Press F2, or right-click and choose Rename.
  3. Type the common base name and press Enter.

Explorer keeps each file’s extension and adds a numeric suffix, so a base name of summer_trip_2023 produces summer_trip_2023 (1).jpg, summer_trip_2023 (2).jpg and so on. Ctrl+Z undoes the operation, which is the safety net worth remembering before you press Enter.

Limits to know

  • Order follows the current sort. If you need pages in a specific order (a cover, then page 1, page 2), sort the folder by the column you care about before selecting. The numbering follows what you see on screen, as far as we can tell from the documented behavior, so check the first few results after renaming.
  • The pattern is fixed. The “(1)” style cannot be changed to “001” here. If you want zero-padded numbers or a different separator, move to PowerRename or PowerShell.
  • No find-and-replace. Everything receives the same base name, so you cannot selectively edit parts of existing names.

PowerRename: preview, regex and undo

PowerRename is part of Microsoft PowerToys, a free add-on you install separately. Once it is enabled in PowerToys, the workflow described in Microsoft’s documentation is:

  1. Select the files in File Explorer.
  2. Right-click and choose Rename with PowerRename.
  3. Fill in Search for and Replace with.
  4. Check the preview, which lists the original and renamed names side by side.
  5. Apply the rename.

The options matter as much as the fields. PowerRename can target the file name only or the extension only, switch case sensitivity on or off, match all occurrences or only the first, include or exclude files and folders, and reach into subfolders. After applying, an undo is available.

A worked example

Suppose a phone export left you with names like IMG_4021.jpg through IMG_4087.jpg, and you want Paris_4021.jpg and so on. The settings would be:

  • Search for: IMG_
  • Replace with: Paris_
  • Apply to: file name only (not extension)
  • Preview: confirm that all 67 rows change and that every extension still reads .jpg

The same job needs no regex at all, which is a useful reminder: literal replacement is the safer default, and regular expressions are worth switching on only when the pattern really varies.

When you do need regex

Patterns are where most mistakes happen: a greedy match, a forgotten dot, a case-sensitivity setting that does not behave as you assumed. Microsoft’s own guidance stresses reading the preview columns, and we agree with the emphasis. Before you type a pattern into any renamer, you can try it on sample names in our Regex Tester, which shows matches, groups and the replace result for JavaScript regular expressions. One caveat: regex engines differ in small ways between tools, so treat the browser test as a first draft and confirm in the renamer’s own preview. If you cannot yet write the pattern, the Regex Generator builds one from examples you supply, which you can then check the same way.

When you do need regex — overview diagram

Command Prompt and PowerShell: rules you can repeat

A script earns its place when you will run the same rule again, or when the file set is too large to click through.

Command Prompt

The rename command (also available as ren) accepts the * and ? wildcards, so one command can handle many files. It cannot move files to another drive or directory, and each destination name must be unique. That second point is the practical risk: if your rule strips the part of the name that made each file distinct, you create collisions. Command Prompt is best for simple extension swaps and short wildcard renames.

PowerShell

Rename-Item changes an item’s name without touching its contents, and it cannot move an item. Combined with Get-ChildItem, which defines exactly which files are in scope, it can compute a new name for every match. Microsoft’s example changes all .txt files in the current folder to .log. An adaptation for our photo example looks like this:

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

The expert habit here is to narrow the input before writing the replacement. Run Get-ChildItem *.jpg on its own first, confirm the list is what you expect, and only then add the pipe to Rename-Item. Test the whole command on a copied folder before pointing it at originals. PowerShell is not forgiving about undo, so the copy is your undo.

PowerShell file selection and rename workflow

Mac: Finder’s Rename, step by step

According to Apple’s support guide, you select the items in Finder, Control-click one of them, and choose Rename. A dialog then offers three modes:

  • Replace Text: find a string in the names and substitute another.
  • Add Text: put text before or after the existing name.
  • Format: replace the names with a custom name plus an index, counter or date, placed before or after the name.

Format is the one to reach for with photos: pick Name and Index, type the base name, choose where the number starts, and Finder previews the first result in the dialog before you confirm. Apple also notes that a colon cannot be used in a name, and that changing a filename extension may stop the file opening in its associated app.

Name for your future self

Batch renaming is a good moment to settle a naming convention, since consistent names are what make search and sorting work. If dates are part of your scheme, putting the year-month-day first makes files sort chronologically by default, and one practical write-up of date-first file naming explains the habit and why it helps people who struggle to keep folders organized. It works equally well in Finder’s Format mode or any other renamer.

Google Drive and other cloud storage

Drive is the weakest of the options for bulk work. Google’s documentation describes selecting several items (Ctrl-click on Windows, Command-click on Mac) and then using the toolbar actions, and Google’s keyboard shortcut table lists F2 as the rename shortcut for selected items. The help pages do not describe pattern rules like those in PowerRename or Finder. For anything beyond a handful of files, a common approach is to download the folder, rename locally with the tools above, and upload again. Check first that nothing links to the old file names.

A preview-first routine that prevents mistakes

The research behind all the vendor guidance points to the same sequence. None of it is complicated, but skipping a step is how people lose track of originals.

  1. Copy the folder, or at least select a small test set first. A rename is not a move, so the originals stay where they are, but you cannot easily recover the old names later unless you saved them.
  2. Write the rule in plain words (“replace IMG_ with Paris_ in the file name, keep .jpg”). If you cannot say it plainly, the pattern is probably wrong.
  3. Read the preview, both columns, not just the first row. Look for names that end up identical, empty names, and names that changed more than you meant.
  4. Check extensions. Unless you are deliberately converting a naming scheme, they should be unchanged. Renaming an extension does not convert a file, it only changes how the system decides which app opens it.
  5. Apply, then spot-check the first, last and a middle file, and open one.
  6. Keep undo in mind: Ctrl+Z in Explorer, PowerRename’s undo, but nothing automatic for scripts.

Name collisions and length

When a rule removes the part of a name that made it unique, two files want the same name, and the system either refuses or appends a number depending on the tool. Prevent it by keeping a counter or original ID in the new name. Also remember that names with characters like colons are rejected on Mac, and many other systems have their own forbidden characters, so keep to letters, numbers, hyphens and underscores if the files travel between systems.

Special cases readers ask about

Renaming image files

For photos, Explorer’s shared base name or Finder’s Format mode covers most needs. If you also need the pictures smaller before sharing, our Image Resizer supports exact pixel, percent and batch resizing in the browser, so it pairs with whichever renaming method you choose. Rename first, resize second, and the new names are easier to follow through the process.

Different names for each file

A rule cannot invent names that are not in your data. If every file needs a unique, meaningful name (for example PDFs named after clients), prepare a two-column list of old and new names in a spreadsheet, then generate commands from it, one line per file. Before pasting a column of names anywhere, it helps to remove stray spaces, double spaces and hidden characters, which is what our Text Cleaner is for. For numbered sequences, such as lines reading file-001 to file-050 that you can paste next to your list, the Text Repeater can repeat and number text and download the result.

Cleaning up pasted names

Names copied from web pages or documents sometimes carry non-breaking spaces or trailing blanks that are invisible in a file list but break a search-and-replace rule. If your pattern matches in the tester but not in the renamer, hidden characters are a likely cause.

Doing the thinking in the browser

Since GizmoBench tools run locally in the browser, with no account and no upload, you can paste sample file names into them without sending the names to a server. That matters when file names contain client names or personal details. For this topic our relevant tools are the Regex Tester for checking a pattern, the Regex Generator for drafting one, and the Text Cleaner for tidying lists of names. Image work lives in the Image Resizer, and the wider catalog of everyday tools is on the everyday tools page. Core functions are free to use, though we make no promise that every feature will stay free indefinitely.

Which method should you pick?

  • Fewer than about fifty files, one shared name: File Explorer or Finder Format. Setup time is zero.
  • Text to swap in many names: PowerRename or Finder’s Replace Text. Use the preview.
  • A pattern that varies from file to file: PowerRename with regex, drafted and tested beforehand.
  • A job you will repeat: a PowerShell one-liner saved in a note, run on a copied folder first.
  • Files in cloud storage: download, rename, upload, unless there are only a few.

The pattern in this comparison is that the simplest tool that can express your rule is usually the safest, because fewer options mean fewer ways to be wrong. A limitation of this guide is that it covers each vendor’s documented features, not performance on very large folders, and we have not benchmarked any of them.

FAQ

How do I rename multiple files at once without extra software?

On Windows, select the files in File Explorer, press F2, type a name and press Enter. Explorer keeps extensions and numbers the files. On a Mac, select them in Finder, Control-click, choose Rename and pick Format, Replace Text or Add Text.

Can I undo a batch rename?

In File Explorer, Ctrl+Z reverses the operation, and PowerRename has its own undo after you apply. PowerShell and Command Prompt have no built-in undo, so work on a copy of the folder first.

Is it safe to change file extensions while renaming?

Usually not. Apple warns that changing an extension may stop the file opening in its usual app, and a different extension does not convert the file’s contents. Target only the base name unless you know what you are doing.

What if my new names would be identical?

Windows requires unique names within a folder, and the rename command rejects duplicates. Keep a counter or an original ID in the pattern, and read the full preview before applying.

Sources