View Full Version : QDir entryList performing slowly

4th October 2009, 18:16
Hey trolls,

I want to retrieve every file name in a directory.

I'm doing this:

dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);

And guess what... When you have 10000+ files in a directory It's very slow.

Is it possible to retrieve files by chunk, like 100 by 100 or something ?


5th October 2009, 10:06
Well, you could call entryList() repeatedly to get first all files starting with a, then b,...
- doesn't help though, when all files start with a common prefix...

A single call to entryList() takes as long as it takes.
You can file a request for enhancement with the trolls if you think it is slower than it should/could be.


6th October 2009, 11:51
Have a look at QDirIterator: it will allow you to navigate directory entries once at a time, and might satisfy more to your needs.

8th October 2009, 17:21
QDirIterator is the way to go for non blocking directory browsing.