Directory vs Folder

·

3 min read

Brief comparison table

DirectoryFolder
Need to map physical file system
space occupied
No need to be
space not occupied
container of files and folder, sub directorieslogical group of files
4KB size(inode)no specific size
OS create, delete, modifyUser create, delete, modify
hierarchicalvertical
has indexno index
concrete implementationabstract implementation

Folder

Linux-based or Unix-based system, directories and folders essentially refer to the same concept But, more specifically name 'Folder' is used in GUI.

Directory can be open with editer like vim or emacs and can be shown as a raw bytes. it contains index of files and directories. Directory is simply a file that contains a list of filenames and the corresponding inode numbers for each file it "contains". An inode is a data structure on a filesystem that stores all the information about a file, except its name and its actual data.

But folder doesn't. It just group a multiple files and folder. The term "folder" is used to match the real-world concept of a folder as a holder of documents, but in the file system, these are still directories. "folder" was popularized with the advent of GUIs because the visual metaphor of a folder holding documents is easy to understand. However, the underlying concept of a directory in a filesystem predates GUIs and is present even in command-line interfaces(Such as mkdir, cd(changedir), etc)

Folder doesn't always correspond to a physical directory

Virtual folders

When you open a virtual folder, the system dynamically queries the filesystem

examples

email application you might have a "Spam" folder that contains all emails marked as spam. These emails might not be stored together physically on disk; the application simply lists them together in the "Spam" folder based on their spam status.

Software applications Database management system might display tables or other objects in a tree-like structure, or a project management application might use folders to group related tasks together.

Cloud storage services Services like Google Drive or Dropbox use the concept of folders to help users organize their files in the cloud. While these folders do map to some form of directory structure on the server side, that structure is abstracted away from the user. From the user's perspective, a Google Drive folder doesn't correspond to a physical directory on their local filesystem.

Folder concept came from GUI because

Whereas directory is controled by operation system through file system, folder and tit's metadata are managed through user application like file system manager(or File Exploer)

Summary

  • A directory is a concept that is integral to the filesystem, which is managed by the operating system. Directories are part of the hierarchical structure of the filesystem, and they are used to organize files. The metadata for directories, such as permissions, timestamps, and ownership, is also managed by the filesystem.

  • A folder, in the context of a graphical user interface like a file explorer or file manager application, represents a directory in a more visual, user-friendly way. When you open, move, rename, or delete a folder in a file manager, the application communicates with the operating system to perform the equivalent operations on the underlying directory in the filesystem.

  • In addition, file managers can implement higher-level features like virtual folders. As we discussed earlier, these are not actual directories in the filesystem, but dynamic views or queries that group files based on certain criteria. The metadata for virtual folders, such as their name and the criteria that define them, is managed by the file manager application, not the filesystem.

Did you find this article valuable?

Support arch dsp by becoming a sponsor. Any amount is appreciated!