[Qt-interest] get files in sub-directories

Jason H scorp1us at yahoo.com
Wed Jun 23 21:02:28 CEST 2010


You are going to have to build a list recursively, also use setFilters() to include directories. Actually, I would get the two lists seperately, one list of dirs and one list of files.





________________________________
From: caius ligarius <caius9090 at gmail.com>
To: Qt Interest <qt-interest at trolltech.com>
Sent: Wed, June 23, 2010 2:43:48 PM
Subject: [Qt-interest] get files in sub-directories

HI,

How do I get all files in a folder and sub-folders? Currently I do the following, which give me files only in the main folder and not the sub-folders-

QFileDialog fileDialog;
QString dir = fileDialog.getExistingDirectory(this, tr("Open Directory"), DEFAULT_BAGDIR);
QDir bagDir(dir);
QStringList filters;
filters << "*.jpg";
bagDir.setNameFilters(filters);
QFileInfoList listofBags = bagDir.entryInfoList();


Thanks,
Caius



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100623/6329ae66/attachment.html 


More information about the Qt-interest-old mailing list