Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileDialog:Recursive selecting files for unzip
Forum Update on Monday, May 27th 2025

QFileDialog:Recursive selecting files for unzip

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 240 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Iftekhar
    wrote on last edited by
    #1

    I want to use 7za.exe as a subprocess in qt application, select a root directory using the browse button, look for all .zip and .7z files and extract their content.
    Now with the code I came up

    1. I am unable to recursively select any .zip or .7z in the root folder and extract them.
    2. How can I get the files name of the files that has been extracted from the root folder?
    void MainWindow::uncompressZipFile()
    {
        QStringList queryArguments;
        queryArguments << "e";
        queryArguments << """" + choosenDir  + """"+"/*.zip";
        queryArguments << "-ro"+choosenDir+"/example";
    zipperProcess.setWorkingDirectory(QCoreApplication::applicationDirPath());
        qDebug() << zipperProcess.workingDirectory();
        qDebug()<<queryArguments;
        zipperProcess.start("7za.exe", queryArguments);
    }
    
    
    void MainWindow::on_browseFileButton_clicked()
    {
        qDebug()<<"browse button clicked";
    
        choosenDir = QFileDialog::getExistingDirectory(this, tr("Choose catalog"), ".", QFileDialog::ReadOnly);
    }
    
    jsulmJ 1 Reply Last reply
    0
    • I Iftekhar

      I want to use 7za.exe as a subprocess in qt application, select a root directory using the browse button, look for all .zip and .7z files and extract their content.
      Now with the code I came up

      1. I am unable to recursively select any .zip or .7z in the root folder and extract them.
      2. How can I get the files name of the files that has been extracted from the root folder?
      void MainWindow::uncompressZipFile()
      {
          QStringList queryArguments;
          queryArguments << "e";
          queryArguments << """" + choosenDir  + """"+"/*.zip";
          queryArguments << "-ro"+choosenDir+"/example";
      zipperProcess.setWorkingDirectory(QCoreApplication::applicationDirPath());
          qDebug() << zipperProcess.workingDirectory();
          qDebug()<<queryArguments;
          zipperProcess.start("7za.exe", queryArguments);
      }
      
      
      void MainWindow::on_browseFileButton_clicked()
      {
          qDebug()<<"browse button clicked";
      
          choosenDir = QFileDialog::getExistingDirectory(this, tr("Choose catalog"), ".", QFileDialog::ReadOnly);
      }
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Iftekhar You can iterate reqursevely using https://doc.qt.io/qt-5/qdir.html#entryList

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved