Skip to content
Start free

What's a folder, and what's a file path?

Follow a worked example, then find a file yourself with the terminal in your browser and write its path.

Free course. Your Maestro, an AI, .

A folder is a container with a name: it holds files, and it can hold other folders. Since one folder can live inside another, together they form a tree: at the top is your home folder, inside it your Documents, inside that a Reports folder, and inside that, at last, the file.

A is the route you take through that tree to reach a file: the name of each folder, in order, and the file's name at the end. It's the file's address, like a street, number and neighborhood.

  1. Your home folder

    the starting point

  2. Documents

  3. Reports

  4. ventas_marzo.csv

    the file

Each arrow is one step further in. The path strings the names together in that order: Documents, Reports, ventas_marzo.csv.

When you double-click in File Explorer or Finder, your computer walks that route for you. A lets you walk it by typing, and that has one big advantage: you always see which folder you're in and what's there. You'll use just four commands:

CommandWhat it does
pwdTells you which folder you're in.
lsLists what's in that folder.
cd informesTakes you into the informes folder. cd .. takes you back up one folder.
cat notas.txtShows what's inside a text file.

cd doesn't move files: it moves you. It's like walking from one room to the next.

Below is La Tapatía's folder of sales reports, with one file per month and year (the folders have Spanish names: informes means reports, ventas means sales). First, watch how to find one, step by step. Before you open each step, try to say which command comes next.

Finding the February 2026 sales

Worked example · 5 steps

Ana asks you for the February 2026 sales from all three branches. You know they're somewhere in the project's reports folder below, but not which folder exactly. How do you find them with the terminal, and what's their path?

Work out the next step yourself, then open it to compare.

Your turn

Ana also needs the sales for March 2026. Same route, this time without the steps laid out. Heads up: the project has more than one file named ventas_marzo.csv.

  1. Find it with pwd, ls, cd and cat, like in the example, and use cat to make sure its dates are from March 2026.
  2. Go back to the project folder, put its path in RUTA inside abrir.py, and run python abrir.py. You've got it when it says it found the file in informes/2026 with 4 rows of sales.

If you get stuck, ask your Maestro about what the terminal told you.

Before you start looking, run python abrir.py once without changing anything. The path still says just ventas_marzo.csv, and your terminal should reply with this:

Expected output
Nothing found at: ventas_marzo.csvUse ls and cd to check which folder the file is in.

You didn't break anything. The program looked for a file with that name in the project folder, and there isn't one there: both ventas_marzo.csv files are further in. That message is your starting point. Once the path is right, the program will tell you which folder it found the file in and how many rows of sales it has.

Your turn

Find the March 2026 sales with pwd, ls, cd and cat. Then put its path in abrir.py, counted from the project folder, and run python abrir.py. You've got it when it says it found ventas_marzo.csv in informes/2026 with 4 rows of sales.

    Python 3.12· runs with your account

    Look at what you just did: there were two files named ventas_marzo.csv, and only the path tells them apart. informes/2026/ventas_marzo.csv and informes/2025/ventas_marzo.csv are two different addresses. That's why, when someone tells you "it's in the sales folder," you're still missing information.

    Tomorrow at work

    Next time you ask for a file, ask for its path too, or at least the folders you have to go through. And when you send one, do the same: "it's in Reports, inside 2026" saves everyone a round of messages. If all you get is a name and you find two files called the same thing, don't guess: open them, like you did with cat, or ask which one it is. A repeated name is exactly when opening the wrong file feels just like opening the right one.

    Check yourself: Ana tells you: open ventas_marzo.csv. In the project folder there's informes/2025/ventas_marzo.csv and informes/2026/ventas_marzo.csv. What are you missing to know which one to open?