File Paths

A file path describes the location of a file in a computer’s folder structure. They are used to locate files, like:

URLs and File Paths

URLs are addresses where data and websites are hosted on the web and are more permanent. File paths are relative to where they are hosted normally on a server inaccessible to most people and are more temporary.

Relative File Paths

Relative file paths link to a local file in the same folder or on the same server, for example:

  • ./about.html
  • ./js/script.js
  • ./scripts/

Relative file paths begin with ./ followed by a path to the local file. ./ tells the program to look for the file path from the current folder. To go up one level in the file structure, two periods followed by a forward-slash are used: ../.

Edit this page on GitHub


Interested in helping build Docs? Read the Contribution Guide or share your feedback form.

Learn More on Codecademy