![]() ![]() I wrote this and tested it on 64-bit Linux, but it should work on any POSIX-compliant system, including Microsoft Windows. Since it's clear some folks want to know how to do all this, I have a lot of comments in the code to try to make it obvious what's going on. That last one, dircnt, is the program compiled from the above source.ĭue to popular demand, I've re-written this program to be recursive, so it will drop into subdirectories and continue to count files and directories separately. ![]() Printf("%s contains %ld files\n", argv, count) įrom my testing without regard to cache, I ran each of these about 50 times each against the same directory, over and over, to avoid cache-based data skew, and I got roughly the following performance numbers (in real clock time): ls -1 | wc - 0:01.67 The fastest way is a purpose-built program, like this: #include
0 Comments
Leave a Reply. |