【代码片段】Qt6.2.4 C++ 获取目录与排除指定文件夹
参考
环境
| 环境 | 版本 | 
|---|---|
| windows | 10 | 
| QT | 6.2.4 | 
| Qt Creator | 8.0.1 (Community) | 
| qmake | 
代码
    QString phpDir = "C:/wamp/php";
    QDir dir(phpDir);
    // 构造筛选条件,可以为空
    QStringList filters;
    // 查找php命名相关
    filters << "php*-x86" << "php*-x64";
    // 查找文件夹并且不查找 . 与 ..
    QList<QFileInfo>files = dir.entryInfoList(filters, QDir::Dirs | QDir::NoDotAndDotDot);
//    QList<QFileInfo>files = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
//    QList<QFileInfo>files = dir.entryInfoList();
    for (int i = 0;i < files.count(); i++) {
        qDebug() << files[i].fileName();
        qDebug() << files[i];
    }
    博  主 :夏秋初
地 址 :https://www.cnblogs.com/xiaqiuchu/p/16720626.html
 
如果对你有帮助,可以点一下 推荐 或者 关注 吗?会让我的分享变得更有动力~
转载时请带上原文链接,谢谢。
    
地 址 :https://www.cnblogs.com/xiaqiuchu/p/16720626.html
如果对你有帮助,可以点一下 推荐 或者 关注 吗?会让我的分享变得更有动力~
转载时请带上原文链接,谢谢。
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号