checking files in all sub-directories 2.0



  • Hi all! i think I asked the same question as the same as tile . Here is the link :Click Here

    If you browse the link above , you will see , i already posted 2 solution. But the solution doesn't meet my requirement. All I want for my program is just list all the sub directories , perform a checking operation , and then return an absolute path for the result. The logic and concept on how to list all sub directories, perform checking operation , and return an absolute path for the result is provided in the solution . Please go through it once, and then guide me from there . Running out from ideas on how to solve this issues. Your help will be appreciated !



  • Dear all, After hour of struggling . Finally i have come out with a solution , Feel free to take a look.
    credits :@SGaist @the_ @mrjj

    //This is the fliters
    QDir::Filters df = QDir::Dirs |QDir::NoDotAndDotDot;
    QDirIterator::IteratorFlag dff = QDirIterator::Subdirectories;

    QString root = "C:/Users/USER/Desktop/FileA/";
    QDirIterator it(root,df,dff);
     while(it.hasNext())
    {
        //performing checking operation
       //QString str = "fileE";
         QString str2 = it.next();
    
         if(str2.contains("fileE"))
         {
            qDebug()<<str2;
         }

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.