QDir dir("/path/to/directory"); QFileInfoList list = dir.entryInfoList(QDir::Files); foreach(const QFileInfo &file, list) { qDebug() << file.fileName(); qDebug() << file.absoluteFilePath(); }
QDir dir("/path/to/directory"); QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); foreach(const QFileInfo &dirInfo, list) { qDebug() << dirInfo.fileName(); qDebug() << dirInfo.created().toString(); qDebug() << dirInfo.size(); }This code uses `entryInfoList` to get a list of all directories (excluding the "." and ".." directories) in `/path/to/directory`. It then iterates through each directory in the list and prints its name, creation time, and size (which for directories is always 0) using the `fileName`, `created`, and `size` functions of QFileInfo.