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?
Another sample which indexes all files, using QFileInfo:
void ID3Tab::scanDir( QDir dir )
{ QFileInfoList fil = dir.entryInfoList( QStringList( "*.mp3" ),
QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks,
QDir::Name | QDir::IgnoreCase );
foreach ( QFileInfo fi, fil )
indexFile( fi );
QFileInfoList dil = dir.entryInfoList( QStringList( "*" ),
QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks,
QDir::Name | QDir::IgnoreCase );
foreach ( QFileInfo di, dil )
scanDir( QDir( di.absoluteFilePath() ) );
}