Files do not actually reside inside directories. A directory is a file that contains references to other files. The directory holds two pieces of information about each file:
Filenames are only used by the system to locate a file and its corresponding inode number. This correspondence is called a link.
To the system, the file is the inode number. Multiple filenames can be used to refer to the same file by creating a link between an inode and each of the filenames.