Exclude files with QFileInfoList filter
When using QFileInfoList + QDir, can we filter anythinbg that should be excluded (or does the filtering is only on what is included) ?
- Can I filter the . , .. files (so that they are excluded from list) ?
- Can I filter all files that have some substr in the name such as "garbage" string: xxx_garbage_xxx (so that they are excluded from list) ?
As the "documentation":http://doc.qt.io/qt-5/qdir.html#entryInfoList suggests: yes, you can filter the results as you wish.
QFileInfoList list = dir.entryInfoList("*.exe", QDir::NoDotAndDotDot | QDir::Files);
// or just
QFileInfoList list = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Files);