a directory
Picture the index at the back of a big reference book: it does not contain the chapters themselves, it just lists names and tells you what page each is on. A directory is that index for files. It is the thing you usually call a folder, and its job is to map human-friendly names onto the files those names refer to. Without directories you would have to remember every file by an internal number, an impossible way to live.
Here is the clever part: a directory is itself just a special kind of file. Its contents are not your document text or photo pixels but a table of entries, each entry pairing a name with enough information to find the corresponding file's metadata (in Unix-style systems, the name plus an inode number). When you ask to open report.txt, the OS reads the current directory's table, finds the entry whose name is report.txt, follows it to the file's metadata, and from there to the data. Because a directory is a file, it can be listed, it has its own permissions, and it can contain entries that name OTHER directories, which is how folders nest inside folders.
Why it matters: directories are what turn a flat heap of files into an organised, navigable namespace. The way directories are allowed to refer to one another defines the whole shape of the file system, from the early single-level scheme to the tree we use today. A key clarification: the directory does not contain the files in the sense of physically holding their bytes; it only holds their NAMES and pointers. That is exactly why one file can appear in two directories at once (hard links), the bytes are shared, only the name entries differ.
Listing a folder shows report.txt, photo.jpg, and a sub-folder backups. Internally the directory file holds entries like ("report.txt", inode 812), ("photo.jpg", inode 4490), ("backups", inode 77). The directory stores names and pointers, not the files' bytes.
A directory is a file whose contents are name-to-file mappings.
A directory does not physically contain a file's bytes, only its name and a pointer to its metadata. That separation is why one file can be named in several directories at once (hard links).