I want to recursively scan a directory and all its sub-directories for files with a given extension - for example, all *.jpg files. How can you do that in Qt?
This should work :
void scanDir(QDir dir)
{
dir.setNameFilters(QStringList("*.nut"));
dir.setFilter(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);
qDebug() << "Scanning: " << dir.path();
QStringList fileList = dir.entryList();
for (int i=0; i
The differences from your code are the following:
I tested it and it works correctly, but notice the following: