Bounding Unicorns

Directories Vs Folders

Today we are going to examine the difference between folders and directories to hopefully eliminate confusion between them.

A directory is a container of other directories and files in a file system. A folder is how containers of items are represented in most contemporary GUIs.

Directory, being a filesystem concept, dates back to at least DOS and Unix days prior to either having graphical user interfaces (Windows for DOS, there were many for Unix).

Folder is a newer concept but it does not replace directory as a concept - when referring to the container of files rather than the icon on the screen the correct term to use is still "directary".

Most of the time, a folder corresponds to a directory. However, a folder can contain items other than files and directories, it may not correspond to a directory at all, or may correspond to different directories at different times.

At the same time, when referring to items other than files, for example network shares or control panel items, the correct term to use is "folder".

Shell folders on Windows provide examples of all of the above:

  • "My documents" is a folder. Which directory that folder corresponds to can be changed via a registry setting.
  • When viewed in Windows Explorer, "My documents" folder is located under "Desktop" hierarchically. On the file system, by default, "Desktop" and "My documents" directories are siblings, being children of the user profile directory.
  • Windows considers "Control panel" and "Network connections" shell folders. There are no physical directories corresponding to either. "Control panel" is a program, "Network connections" is an internal Windows data structure.
  • There is a directory corresponding to "Desktop" in windows. Files and directories placed in that directory will appear on the user's desktop. However, the desktop also has "My computer" icon on it in the UI. "My computer" is not a directory - it is an item that exists only in the shell.

Windows calls the things that might be found in folders shell items. A shell item might correspond to a file, or to an object that has no filesystem counterpart.

Wikipedia also notes the distinction between directories and files:

There is a difference between a directory, which is a file system
concept, and the graphical user interface metaphor that is used to
represent it (a folder).