boost – Ashwin Sinha

Getting all files of a specific type, in a specified folder using Boost. (returned in alphabetical order)

Getting all files of a specific type, in a specified folder using Boost. (returned in alphabetical order) //Accepts a path to a directory //a file extension //and a list //Puts all files matching that extension in the directory into the given list. //Sorts and returns the results void GetFilesOfTypeInDirectory(const boost::filesystem::path &directoryPath, const string &fileExtension, std::vector<boost::filesystem::path> […]

Getting all files in a specified folder using Boost.

Getting all files in a specified folder using Boost. Also check out how to get files of a specific type, and sorted results here! #include <boost/filesystem.hpp> #include <boost/range/iterator_range.hpp> //returns a list of all the files in a given folder. std::vector<boost::filesystem::directory_entry> GetAllFilesInFolder(boost::filesystem::path folderPath) { try { if (exists(folderPath)) // does p actually exist? { std::vector<boost::filesystem::directory_entry> files; […]