How to read and write a filepath
Mac Tip #513, 23 November 2011
Every file and folder on your Mac has a unique ‘address’ — its filepath. It’s easy to understand and read them, once you know how. Learn how to read filepaths here.
- Start with the hard drive name as the base and then name each file or folder, becoming more specific. Separate each item with a slash:
- Use a slash by itself to refer to the Root Directory:
- Use a tilde as a shortcut to refer to the Home Directory:
Want more detail? Read the full Tip below.
In Open and Save can be easier I mentioned using a shortcut in an Open or Save dialog box. That shortcut relies on understanding filepaths. Here’s what you need to know about the path of a file.
Find a file
If you open a new window in the Finder you should see a bunch of files. They might be in your
Documents folder, for example. The screenshot shows part of my
Documents folder. You will surely have different things in your
Some of the items in my
Documents folder are files, while others are folders that may contain more folders or files or both.
If you look at the bottom of the Finder window in the screenshot, you’ll see the filepath for my
Macintosh HD — Users — miraz — Documents.
Yours should be the same, except instead of
miraz it’ll have your username.
If you don’t see the filepath at the bottom of a Finder window on your Mac read View the Path of a File.
File paths and slashes
Although in these Tips I commonly use dashes or arrows to show that a file or folder is inside another, a more conventional way of writing a filepath is to use slashes to separate the items, like this:
That filepath shows that the
Documents folder is inside the
miraz folder, which in turn is inside the
Users folder. The
Users folder is on the Hard Drive which is named
Directories and folders
Sometimes folders are called directories. Both refer to the same thing.
The Root Directory
When a brand new Mac comes from the factory its hard drive is usually named
Macintosh HD. That’s what’s known as the
Root Directory. Sometimes, especially if you’re writing out or referring to the
root directory you can refer to it with just a slash:
Make sure you use the forward slash at the bottom of the keyboard near the letter
M and not the backslash above the
Return key, near the square brackets.
The single slash at the start explains the filepath above:
/Users/miraz/Documents. It starts with a slash, so it’s saying that the
Users directory (or folder) is directly inside the
Macintosh HD directory.
The Root Directory usually has certain folders in it:
It may have a few other items, as mine does as you can see in the screenshot, but it definitely should have those 4 folders.
The Home Directory
Your Mac has certain
Users. You are one of them. On my Mac I’m the User called
All the Users have their own named folder inside the
Users folder. The main folder for a particular User is called their
The tilde character
Just as a slash (
/) is a shortcut for referring to the Root Directory, so the
~ (tilde) character is a shortcut for referring to the Home Directory for the User who is currently logged in.
Can’t find the tilde key? It’s at the extreme top left of the keyboard, just to the left of the number
1. To type a tilde hold down
Shift (⇧) and type the key above the
Tab and to the left of the
A couple of examples
In the screenshot above I’ve typed
/Users/miraz/Sites/runspotrun/. This represents the filepath for the folder named
runspotrun in the
Sites folder in my Home Directory.
Another way to type that same filepath is to use the tilde shortcut to represent my Home Folder:
Of course, you could always write it out the long way too:
Quickly go to a folder in the Finder
Let’s say you’re in the Finder and want to quickly get to a folder perhaps buried deep in the system.
Command (⌘) Shift (⇧) G. A small text box opens up like the ones in the screenshots above.
- Type in the filepath for the folder you want to get to.
- Click the
Gobutton. The folder whose path you entered opens in a Finder window.
Now combine that with some TextExpander macros and you can zip around your folder system with ease.
I love your comments — they help me know what to write about and they help other readers too. Please visit the website and leave your comments on this Tip there.
And please remember to tweet about the Tips, mention them on Facebook, like our MacTips Facebook page and generally share the Tips around. The main site gets around 98,000 page views per month, and I’m hoping to get over 100,000 this month if I can!
Credit where it’s due
This Tip was written by Miraz Jordan, http://mactips.info, and is available under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.