Skip to content
BENIBIX Learn

File Path

Development🖥️ Platforms & OSFiles and Folders

Also known as Path, Filepath, File Location

The address of a file. It lists each folder from the top, then the file.

Think of it like

Think of it like a street address. Country, town, street, then house number.

Example

Emma's notes sit at the path shown below. From inside her own folder, she can type just notes.txt.

Why it matters

Programs find every file by its path. A wrong slash or one missing folder means file not found.

Definition

A file path is the address of a file. It lists each folder from the top down to the file. On Linux and macOS, the parts are split by a forward slash. On Windows, they are split by a backslash and start with a drive letter. A path from the root is absolute. A path from the folder you are in is relative.

Example code

console
$ cat /home/emma/notes.txt
Buy milk
An absolute path, from the root down to the file.
The lit boxes are the path. Written out, it is /home/emma/notes.txt.

Common mistake

Typing a path with backslashes into Linux code. Use forward slashes, or a library that builds paths for each system.

Key takeaways

  1. 1
    Top down. Each folder in order, then the file.
  2. 2
    Slashes differ. Forward on Linux and Mac, back on Windows.
  3. 3
    Absolute or relative. From the root, or from where you are.

Learn it properly