From the user’s perspective, a directory is a container, as opposed to a file. However, from a file system’s perspective, a directory is nothing more than a special file.
As a special file, a directory serves as an index to the contained file. A directory also stores special information about the contained files, such as special flags and permissions.