[Interest] equivalent of python glob

Bob Hood bhood2 at comcast.net
Fri Aug 23 16:38:56 CEST 2019


On 8/23/2019 12:46 AM, Hamish Moffatt wrote:
> Hi,
>
> In Python one can write the expression: glob.glob("/usr/bin/*") and get a 
> list of such files. I am looking for something similar in Qt (in C++).
>
> I have look at QDir::entryList() and entryInfoList(), but it seems I would 
> have to extract the path first and provide it to QDir. I can't use 
> QDir('/').entryList({ "/usr/bin/*" }), as it returns nothing.

Look at QDirIterator.

e.g., QDirIterator iter(base_folder, QStringList() << "*.*", QDir::Files, 
QDirIterator::Subdirectories);



More information about the Interest mailing list