# What type of an algorithm is being used for directory structure scanning?

So after learning about DFS and BFS yesterday in my class I was curious as to how is scanning on various file system being done. I spent quite a bit of time trying to look for some references on the web, but so far I have failed in doing so. I'm assuming that either DFS or BFS are behind the core "scanning" in some file systems.

There's also Dijkstra's algorithm but as I'm not even sure if file system is a weighted or unweighted tree (ie. number of files being the weight or file size) it's hard to say if it's useful or not because I believe that BFS would be better than Dijkstra if it's unweighted tree.

I hope that someone could clear this up as there just isn't anything specific about it on the web.

• Wait a while. You will learn about dictionary datastructures, and they can be used to create indices which enable fast search. Simple tree traversal doesn't cut it. – Raphael May 25 '16 at 9:29

• Raphael: Rarely. On Unix/Linux, fast searching (locate) is traditionally provided by a separate database built by a nightly filesystem scan with find. – reinierpost May 25 '16 at 10:24
• Raphael: find reads directories, which are files that contain a mapping from filenames to pointers to files (inodes). So it reads a pointer structure consisting of files of a special type. – reinierpost May 25 '16 at 15:57