callum
callum

Reputation: 37739

What is the correct name for each slash-separated piece of a file/URL path?

What is a 'piece' of a path called? (Including folder names, file names, and stuff like .. or .)

../foo/bar/baz
↑   ↑   ↑   ↑

or

https://example.com/foo/bar/baz
                     ↑   ↑   ↑

And does the terminology vary by OS or context?

Upvotes: 18

Views: 4688

Answers (2)

Daniel Kaas
Daniel Kaas

Reputation: 121

I would call it a directory which holds subdirectory and then use parent and child, to describe the relationship between a subdirectory and the directory in which it is cataloged. The top-most directory in such filesystem, which does not have a parent of its own, is called the root directory.

Upvotes: 0

Jacob
Jacob

Reputation: 1578

The terminology varies by context. For most web sites and web applications, the entire path together is taken at once and called, unsurprisingly, path. This follows the standard set forth in RFC 3986, though the standard is still loosely defined throughout the whole document.

For web applications that use parts of the uri as parameters to functions (such as Codeigniter), those pieces are referred to as segments. The reasoning behind Codeigniter's naming convention is derived from the design of the application. Each segment has a purpose, and the purpose is not always to locate the page or function that a user is accessing. Some of the segments are used as parameters to functions just as one might use a query string to pass variables through the uri.

Upvotes: 16

Related Questions