Batch-rename files on Mac, Windows, and the command line
Renumber photos, change extensions, or prefix log files — with concrete recipes for each OS.
Mac (Finder)
- Select the files.
- Right-click > Rename.
- Pick Replace Text, Add Text, or Format (sequential numbering).
Windows (Explorer)
- Select files and press F2.
- Type a base name; Explorer appends
(1) (2)automatically. - For finer control, install PowerToys' PowerRename.
CLI (rename / mv)
# Rename every .jpeg to .jpg (macOS / Linux)
for f in *.jpeg; do mv "$f" "${f%.jpeg}.jpg"; done
# PowerShell: add a zero-padded index
$i = 0
Get-ChildItem *.jpg | ForEach-Object {
Rename-Item $_ ("photo_{0:d3}.jpg" -f $i); $i++
}
Don't get burned
- Keep a copy of the directory before doing a big rename.
- Pad indices with enough digits (001, 002, ...) to avoid collisions.