Skip to content

← All tools

Free online tool

Batch rename planner for Mac

Paste a list of file names, choose a rule and see every new name before anything changes. Names that would clash, or that macOS does not allow, are marked and left out. Then copy a zsh script that renames the files with mv -n, which never overwrites. Your files are not uploaded or opened: the page only works with their names.

In Terminal, cd into the folder and run ls -1 | pbcopy, then paste here. Or pick the files below: only their names are read.

The files are not opened or uploaded; the page only reads their names. Up to 5,000 names.

Rename rule

Preview

3 to rename, 1 unchanged, 0 with a problem (left out of the script).

NowNew nameStatus
IMG_0142.jpgTrip-0142.jpgRenamed
IMG_0143.jpgTrip-0143.jpgRenamed
IMG_0144.jpgTrip-0144.jpgRenamed
Screenshot 2026-09-01 at 10.15.32.pngScreenshot 2026-09-01 at 10.15.32.pngNo change

zsh script

Uses mv -n, which never overwrites a file. When a new name is the current name of another file, the script renames through temporary names so nothing is lost.

  1. Open Terminal and type cd, a space, then drag the folder onto the window and press Return.
  2. Paste the script and press Return, or run the downloaded file with zsh rename.zsh.
  3. Run it with the dry-run box ticked first if you want to read the commands before anything changes.
  4. There is no undo in Terminal. Keep a copy of the folder if the files matter.

How it works

  • •Get the names: in Terminal, cd into the folder and run ls -1 | pbcopy, then paste. Or use Pick files; the browser hands the page the file names only, never their contents.
  • •Replace text finds a string in each name (or a JavaScript regular expression, where $1 inserts the first group) and leaves the extension alone unless you tick the box. Add text goes before the name or just before the extension. Number in order uses the order of the list, so sort it the way you want first. Clean up replaces runs of spaces and can lower-case everything.
  • •Every row is checked the way a default Mac disk sees names: upper and lower case count as the same name, so IMG.JPG and img.jpg clash. A row is left out of the script when two files would get the same name, when another file that is not being renamed already has it, or when the name is empty, is . or .., contains /, or is longer than 255 bytes.
  • •When a new name is the current name of another file in the list (renumbering 1 to 2 and 2 to 3, or a case-only change), the script first moves every file to a temporary name and then to its final name, so no step lands on a name that is still in use.
  • •Names are written in single quotes in the script, so spaces, quotes, $ and other shell characters are safe. mv -n skips a file if its new name is already taken by something outside the list; skips can be silent, so count the files afterwards.
  • •Limits: up to 5,000 names, one folder at a time. For renaming inside subfolders, see the find and zmv recipes in the batch rename guide.

Questions

Does this upload or rename my files?
Neither. The page only sees the names you paste or pick, and it never touches the files. The renaming happens when you run the script in Terminal on your Mac.
Can I undo the rename?
Terminal has no undo. Run the script with the dry-run box ticked first to read the commands, and keep a copy of the folder if the files matter. For small jobs Finder's own Rename dialog can be undone with Command-Z.
Why is a row marked “Another file already has this name”?
A file in the list that is not being renamed (its name stays the same) already uses that name, and on a default Mac disk upper and lower case count as the same name. mv -n would skip it, so the row is left out of the script.
Does it work in bash or on Linux?
The script uses plain mv -n with quoted names, so it also runs in bash and on Linux. Linux file systems usually treat upper and lower case as different names, so the case checks here are stricter than needed there.

Related