Catalog file is a main component in Mac operating system. It is used by the file manager to store all the records of the file hierarchy containing files and folders which are stored on your Mac Volume. It is structured in the form of B-Tree, containing header node, index nodes, leaf nodes and map nodes.
All the files and folders in the catalog file are identified by their unique ID called CNID, Catalog Node ID. These CNIDs play a very useful role in accessing and finding the files from the HFS+ Volumes. In case of folders the CNID is folder ID, and for ﬁles, then the CNID will be the ﬁle ID. The first 16 CNIDs are used by the Mac OS X to store system related files. The CNID contains: The catalog ﬁle key the parent folder’s CNID and the name of the ﬁle or folder and catalog ﬁle data (leaf node) contains records of the files or folders which comprises of following records, explained below:
(These two Thread records just provides the link between its parent folder and itself)
The thread records mainly contain the CNID of its parent file or folder which it references. In order to find or locate a file or a folder using its CNID, first you need to locate the thread record of that file or folder. Using this, you can find its parent folder CNID and also the name. Then, with the help of its parent folder name and ID you can easily locate the file needed.