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

#define BOOST_FILESYSTEM_VERSION 3 #define BOOST_FILESYSTEM_NO_DEPRECATED #include <boost/filesystem.hpp> namespace fs = boost::filesystem; /** * \brief Return the filenames of all files that have the specified extension * in the specified directory and all subdirectories. */ std::vector<fs::path> get_all(fs::path const & root, std::string const & ext) { std::vector<fs::path> paths; if (fs::exists(root) && fs::is_directory(root)) { for (auto const & … Read more