Skip to content
Start free

How do I read a file path on Windows and on a Mac?

Read the same path on Windows and on a Mac, predict what each piece is, and copy the path of one of your own files.

Free course. Your Maestro, an AI, .

Windows and Macs write paths by different rules, but they say the same thing: where you start, which folders you pass through and what the file is called. Once you can read both, you can help anyone on your team, whatever computer they use, and you'll understand why a path someone pastes into the chat sometimes doesn't work on yours.

Here's the same spreadsheet from Ana, your coworker in sales, on each system (her user and folders are made up). Pick yours: the course will remember it on every other page, and you can switch tabs anytime to see how the other system writes it.

C:\Users\ana\Documents\Informes\ventas_marzo.xlsx

PartWhat it is
C:The drive: the letter of the disk where everything starts, followed by a colon.
\The separator between one folder and the next: the backslash.
Users\anaThe Users folder and, inside it, Ana's home folder.
Documents\InformesThe folders that come next, in order (Informes is Spanish for reports).
ventas_marzo.xlsxThe file name. Whatever comes after the last dot, .xlsx, is the extension: it tells you what kind of file it is.

Two Windows details, from Microsoft's documentation: if you type / instead of \, Windows converts it to \; and Windows doesn't care about uppercase and lowercase in folder and file names, so Informes and informes are the same folder.

/Users/ana/Documents/Informes/ventas_marzo.xlsx

PartWhat it is
/ at the startThe root: the point where everything starts. A Mac has no drive letter.
/ between namesThe separator between one folder and the next: the regular slash.
Users/anaThe Users folder and, inside it, Ana's home folder.
Documents/InformesThe folders that come next, in order (Informes is Spanish for reports).
ventas_marzo.xlsxThe file name. Whatever comes after the last dot, .xlsx, is the extension: it tells you what kind of file it is.

One Mac detail, from Apple's help: the APFS disk format, the standard on Macs, isn't case-sensitive, so Informes and informes are the same folder. Apple also offers a variant, APFS (Case-sensitive), that does tell them apart: there, folders named Homework and HOMEWORK are two different folders.

Read a path the way a program does

To a program, a path is text made of pieces: every separator starts a new piece. The last piece is the file name, and everything before it is the folder that holds it. Python has tools that make exactly that cut, and you don't need to know Python to guess what they'll say: just read the path.

Below are three short programs. You won't edit them. Read each one, write down what you think it prints and why, then run it. If your prediction misses, even better: that's the moment you learn the most. If a line isn't clear, ask your Maestro what that line does.

Each program takes a path and asks Python for one piece of it. The comments, after , say which piece each line asks for.

Each program takes a path and asks Python for one piece of it. The comments, after #, say which piece each line asks for.

Ana's path on Windows

Example 1 of 3

ruta_windows.py
from pathlib import PureWindowsPath

ruta = PureWindowsPath(r"C:\Users\ana\Documents\Informes\ventas_marzo.xlsx")

# the last piece of the path
print(ruta.name)
# the file's extension
print(ruta.suffix)
# the folder that holds it
print(ruta.parent)

A guess is fine: it's kept as you wrote it, so you can compare. Only you and your Maestro see your predictions.

Example 2 of 3, opens once you explain this one

Make your prediction

Notice ana. A file's path almost always goes through the home folder of whoever saved it. If Ana messages you "it's in C:\Users\ana\Documents\Informes," that path describes her computer. On yours, if the file exists, it'll be under your own home folder, or somewhere else entirely. That's why a path you copy from someone else almost never works as is: first you have to translate it to your computer.

Copying a file's path

You don't have to type paths by hand. The safest way, on either system, is to copy the path of the folder the file is in, then add the separator and the file name at the end. That's what you just saw in the first program: a file's path is its folder's path plus its name.

  1. Open File Explorer and go to the folder the file is in.
  2. Press F4. Microsoft documents it as the shortcut that selects the address bar, which holds the path of the folder you're in.
  3. Copy it with Ctrl + C and paste it wherever you need it with Ctrl + V.
  4. Add a backslash and the file name with its extension at the end, for example \ventas_marzo.xlsx.
  1. Open Finder and go to the folder the file is in.
  2. Choose View > Show Path Bar, or press and hold the Option key to show the path bar for a moment. The folders that lead there appear near the bottom of the window.
  3. In that bar, Control-click the file's folder and choose Copy “folder” as Pathname.
  4. Paste the path wherever you need it and add a slash and the file name at the end, for example /ventas_marzo.xlsx.

Three things you'll notice when you copy paths at work:

  • They're long. An office path can easily cross six or seven folders. Don't panic: read it left to right, one separator at a time, like in the second program.
  • They have spaces. Informes 2026 or OneDrive - Contoso are perfectly valid names. For a person, no problem; for a program, a space can split the path in two. Module 3 shows you how to hand one to a program without it breaking.
  • Sometimes they don't match your screen. If the path you copied says one thing and the window shows another name for the same folder, trust the path: it's the address programs use.

Try it

Copy the path of a file from work and paste it into the chat so you and your Maestro can read it together. Before you send it, try it yourself: where does it start? Which parts are folders? What's the file called, and what's its extension? If the path includes client names or anything that shouldn't leave your company, change those before you paste it. If your path goes through a folder you didn't expect, like a OneDrive one, hang on to it: that's exactly what module 2 is about.

Check yourself: Ana sends you this path in a chat: C:\Users\ana\Documents\Informes\ventas_marzo.xlsx. You paste it on your computer and it finds nothing. What's the most likely explanation?