Why doesn’t the file system have a function that tells you the number of files in a directory?

There are any number of bits of information you might want to query from the file system, such as the number of files in a directory or the total size of the files in a directory. Why doesn’t the file system keep track of these things?

Well, of course, one answer is that it certainly couldn’t keep track of every possible fragment of information anybody could possibly want, because that would be an infinite amount of information. But another reason is simply a restatement of the principle we learned last time: Because the file system doesn’t keep track of information it doesn’t need.

Full Article – http://blogs.msdn.com/oldnewthing/archive/2009/02/17/9426787.aspx

Comments are closed.