Allow Interchanging "Folder" and "Directory" [VD17]

Allow Interchanging "Folder" and "Directory" [VD17]

Tip VD17

“Folder” and “directory” typically refer to the same thing. It’s almost impossible to avoid intermixing the two terms and doing so doesn’t cause problems, so allowing either is typically simplest.

The terms “folder” and “directory” are often used interchangeably to refer to the same thing. Which someone uses is often just based on their background or whatever surrounding code is doing. While there are distinctions between the terms that are useful to be aware of, trying to be picky about whether someone uses folder or directory isn’t typically useful - most programmers understand them to essentially refer to the same thing. As long as code is being relatively consistent and not switching back-and-forth between the terms every-other-time, interchanging these terms is typically fine (and often not worth the effort in trying to change ingrained programmer habits).

  • If you want to consider distinguishing between the two, consider the following:

    • A “folder” more conceptually refers to a real-world file folder - something that can “hold” other things.

    • A “directory” more conceptually refers to a list of items for the purposes of making things easier to find, like in a business or telephone directory.

    • There may be situations where trying to firmly distinguish a “folder” and “directory” isn’t the feasible - there may not be a perfect solution.

 

The following code example shows how “folder” terminology was chosen (perhaps due to finding it more intuitive) but “directory” terminology existed in third-party APIs. Programmers usually won’t have trouble understanding this code, even if different terminology is used:

Related content