I need my program to count the number of files on disk.
What is the fastest way to do this?
Directory.GetFiles () is not an alternative since it is very slow.
Have you tried to import kernel32.dlland use it?
kernel32.dll
There is a good example of which was published earlier: fooobar.com/questions/66305 / ... . Perhaps worth a look.
Edit: , , . ntfs. . , sdk ++ c. , dll #?
Func<string, int> files = null; files = p => Directory.GetFiles(p).Length() + Directory.GetDirectories(p).Select(p1 => files(p1)); int count = files(@"c:\");
, linqy!
you can read the log of the USN drive, it is very fast, but you need administrator rights