Relative
Relative vs Absolute File Paths
Relative Path:
A relative file path shows the location of a file or folder in relation to your current directory (where you are right now).
- Example:
pictures/vacation.jpg - Analogy: Saying “Patrick’s younger brother”—you only know who he is if you already know Patrick.
Absolute Path:
An absolute file path shows the complete location starting from the root directory, and it’s always the same no matter where you’re starting from.
-
Example:
/home/user/pictures/vacation.jpg(on Linux/Mac) -
Analogy: Saying “James Muir”—you’re given the full name, so you know exactly who it is without extra context.
Summary:
- Relative: Position depends on where you are now, from the working directory
- Absolute: Complete address, does not depend on where you are