How to delete .pack and .idx file using QT
<p>I am able to delete whole content of .git folder except .pack and .idx files using below code on windows 7 OS :</p>

<pre><code>QString strpath = QDir::homePath() + "/Repo/.git/";
    QDir dirForDeleteGit = strpath;
    QStringList strlistForGitDelete = dirForDeleteGit.entryList();

    for (int i=0; i&lt;strlistForGitDelete.count(); i++)
     {
       QString strForGitFilePath = strpath + strlistForGitDelete.at(i);
       QFileInfo fileinfoForGit (strForGitFilePath);


      if(fileinfoForGit.isDir())
       {
         QStringList strlistForDeleteGit(strForGitFilePath);
         QDirIterator it(strForGitFilePath,QDir::Executable| QDir::Hidden| QDir::AllEntries|QDir::System |QDir::NoDotAndDotDot | QDir::AllDirs | QDir::Hidden | QDir::Files,QDirIterator::Subdirectories);

         if(it.hasNext())
         {
           while(it.hasNext())
           {
             strlistForDeleteGit &lt;&lt; it.next();
           }

           int gitCount = strlistForDeleteGit.count()-1;
           qDebug()&lt;&lt;"File count :"&lt;&lt;gitCount;
           for(int j=gitCount; j&gt;=0; j--)
           {
             QFileInfo fileinfor(strlistForDeleteGit.at(j));
              if(fileinfor.isDir())
               {
                  QDir dir(strlistForDeleteGit.at(j));
                   qDebug()&lt;&lt;"dir :"&lt;&lt;strlistForDeleteGit.at(j);
                  dir.rmdir(strlistForDeleteGit.at(j));
               }
              else
              {
                  QFile file(strlistForDeleteGit.at(j));
                   qDebug()&lt;&lt;"File :"&lt;&lt;strlistForDeleteGit.at(j);
                  file.remove(strlistForDeleteGit.at(j));
              }
                }
               }
         else
         {
             QDir dir(strForGitFilePath);
             dir.rmdir(strForGitFilePath.at(i));
         }
           }
      else
      {
          QFile file (strForGitFilePath);
          file.remove();
      }
   }
</code></pre>

<p>Any suggestion/resolution ? I want to delete complete content of .git folder. I have tried by using different different flags for QDirIterator.  </p>