cvxworksfat

Retrieve file count without walking through entire file system


I am on a vxworks 6.9 platform. I want to know how many files are in a folder. The file system is DOSFS (FAT). The only way I know how to do this is to simply loop through every file in the folder and count. This gets very expensive the more files in the folder. Is there a more sensible way to do this? Does there exist some internal database or count of all files in a folder?


Solution

  • The FAT filesystem does not keep track of the number of files it contains. What it does contain is:

    You'll need to walk the directory tree to get a count.