Sub topic 6
Naming and renaming items
This chapter covers how macOS handles file names: the rules and limits, how to rename in the Finder and in Terminal, and a naming scheme that sorts well. It assumes you can create folders and move items in the Finder (covered in earlier chapters) and that you know what a file extension is.
What a name is made of
A file name has two parts: the base name and the extension. In Budget 2026.xlsx, the base name is Budget 2026 and the extension is xlsx. The extension tells macOS which app should open the file by default.
By default the Finder may hide extensions for some files. You can change this in Finder > Settings > Advanced by turning on "Show all filename extensions". Showing extensions helps you spot a file called invoice.pdf.exe or confirm that notes.txt is not really notes.txt.rtf.
Rules and limits
macOS allows most characters in names, but a few cause trouble.
| Character | Behaviour |
|---|---|
| `:` (colon) | The Finder shows a colon as `/` and stores a `/` as `:` internally. Typing a colon in the Finder is allowed but can confuse older apps and scripts. |
| `/` (slash) | Cannot be used in Terminal paths because it separates folders. The Finder lets you type it and stores it as a colon. |
| Leading `.` (dot) | Makes the item hidden. The Finder warns you before it hides a file this way. |
| Very long names | A single name can be up to 255 characters on APFS, the default Mac file system. Shorter names are much easier to read in narrow columns. |
Names are case-preserving. The default Mac volume is case-insensitive, so Report.pdf and report.pdf cannot sit side by side in the same folder. A volume formatted as case-sensitive treats them as different files, which can break a project when you copy it from a case-sensitive disk to a normal one.
Also avoid characters that cause problems when you share files with Windows, Linux or web servers: \ * ? " < > |. Spaces are fine on a Mac. They only matter if you later work in Terminal, where you must quote the name or escape each space with a backslash.
Renaming one item in the Finder
There are four ways to rename a single item. Each ends the same way: the base name becomes editable and you type the new one.
- Select the item and press Return.
- Click the name of an already-selected item and wait a moment.
- Control-click the item and choose Rename.
- Select the item, open Get Info (Command-I), and edit the name under Name & Extension.
Press Return again to confirm or Escape to cancel.
When you start renaming, the Finder selects only the base name and leaves the extension alone. This protects you from accidentally changing the file type. If you do change the extension, the Finder asks you to confirm with a dialog that offers Use .new or Keep .old. In Get Info, the Hide extension checkbox controls whether the extension is visible for that single file.
Why renaming can fail
Renaming is a change to the folder that holds the item, not to the item itself. So these things block it:
- You do not have write permission for the folder. Check Sharing & Permissions in Get Info.
- The file is locked. Get Info shows a Locked checkbox for files in General. Clear it to allow changes.
- The name already exists in that folder. The Finder reports that the name is taken and asks you to pick another.
- The item is a system file or sits in a protected location such as
/System.
Renaming a file does not change its contents, its tags or its creation date. An alias to the file keeps working after a rename because it tracks the file itself, not its name.
Names that sort well
The Finder sorts by name using natural ordering for numbers within a name, so Chapter 2 comes before Chapter 10. Dates are different: they need a fixed structure. The format year-month-day, as in 2026-11-27, sorts in true time order because the largest unit comes first.
A good scheme answers three questions in a fixed order: when, what, and which version.
| Pattern | Example |
|---|---|
| `YYYY-MM-DD Subject - Detail` | `2026-11-27 Lease - Signed.pdf` |
| `Project - Document - vNN` | `Website - Brief - v03.docx` |
| `NN Topic` for ordered folders | `01 Inbox`, `02 Active`, `03 Archive` |
Use leading zeros (01, 02) so that items stay in order past nine. Avoid names such as final, final2 and really final. A version number or a date says more and sorts correctly.
Renaming in Terminal
Terminal gives you precise control when a rule is hard to express in the Finder. The mv command moves an item, and moving within the same folder is a rename. Quote any name that contains spaces.
mv "Budget 2026.xlsx" "2026-11-27 Budget - Draft.xlsx"Be careful: mv overwrites an existing file with the new name without asking. Add -n to refuse overwriting, or -i to be prompted.
mv -n "notes.txt" "2026-11-27 Meeting notes.txt"The next loop adds a date prefix to every PDF in the current folder. It skips any file that would collide with an existing name.
for f in *.pdf; do
mv -n -- "$f" "2026-11-27 $f"
doneThe -- marks the end of options, so a file name starting with a dash is not read as a flag. Test a loop with echo mv ... first, so you see what would happen before anything changes.
Common errors
- Renaming the extension by accident. Keep extension visibility on, and read the confirmation dialog.
- Case-only changes failing in scripts. On a case-insensitive volume, renaming
report.pdftoReport.pdfworks in the Finder but may fail in some tools. Rename through a temporary name when this happens. - Names that look the same. A trailing space or a different dash character can make two names differ. Sort by name and check the Get Info window if a search does not find a file you can see.
- Renaming a folder that an app uses. Apps may remember the old path and report a missing file. Reopen the document from its new location so the app updates its reference.
Exercise
You have three files: Invoice 9.pdf, Invoice 10.pdf and Invoice 2026-11-27.pdf. You want a naming scheme that keeps invoices in time order no matter how many exist. What new name would you give the first one if it was issued on 2026-03-09, and why does the format work?
Show answer
2026-03-09 Invoice - 9.pdf (or 2026-03-09 Invoice 09.pdf). The date is written year-month-day, so alphabetical order equals chronological order. The leading zeros and the fixed field order keep the sorting stable as the list grows.
Exercise
You press Return on a selected file, type a new name, and the Finder says the name is already taken, yet you cannot see another file with that name. Give two likely causes.
Show answer
The other file may be hidden (for example, its name starts with a dot, or the Finder is not showing it), or the volume is case-insensitive and an item exists that differs only in letter case. Show hidden files with Shift-Command-Period, or compare names regardless of case, to find it.