Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi Search files and directories fastest alghorithm

I'm using Delphi7 and i need a solution to a big problem.Can someone provide me a faster way for searching through files and folders than using findnext and findfirst? because i also process the data for each file/folder (creation date/author/size/etc) and it takes a lot of time...I've searched a lot under WinApi but probably I haven't see the best function in order to accomplish this. All the examples which I've found made in Delphi are using findfirst and findnext...

Also, I don't want to buy components or use some free ones...

Thanks in advance!

like image 890
RBA Avatar asked Jun 16 '10 15:06

RBA


1 Answers

I think any component that you'd buy, would also use findfirst/findnext. Recursively, of course. I don't think there's a way to look at every directory and file, without actually looking at every directory and file.

As a benchmark to see if your code is reasonably fast, compare performance against WinDirStat http://windirstat.info/ (Just to the point where it's gathered data, and is ready to build its graph of the space usage.)
Source code is available, if you want to see what they're doing. It's C, but I expect it's using the same API calls.

like image 141
Chris Thornton Avatar answered Sep 21 '22 23:09

Chris Thornton