How to get list of files with a specific extension in a given folder?

前端 未结 6 1879
孤街浪徒
孤街浪徒 2020-11-27 03:29

I want to get the file names of all files that have a specific extension in a given folder (and recursively, its subfolders). That is, the file name (and extension), not th

6条回答
  •  春和景丽
    2020-11-27 03:57

    You don't say what OS you are on, but there are several options.

    As commenters have mentioned, boost::filesystem will work if you can use boost.

    Other options are

    • CFileFind Class with MFC
    • FindFirstFile/FindNextFile with WIN32
    • opendir/readdir with POSIX.

提交回复
热议问题