#include<iostream>
#include<filesystem>
#include<string>
using namespace std;
namespace fs = filesystem;
auto listFilesRecursively = [](auto const& dir, string const& mask = {}){
if(!fs::is_directory(dir))
{
cerr << dir << " is not dir";
throw "is not dir!";
}
for(auto const& file : fs::recursive_directory_iterator(dir))
{
if(fs::is_regular_file(file))
{
if(mask.empty() || file.path().extension().string() == mask)
{
// Здесь твоя функция вывода инфы
cout << file.path().string() << " #size: " << file.file_size() << "\n";
}
}
else if(fs::is_directory(file))
{
cout << "\n****** dir ****** [" << file.path().string() << "]\n";
}
else
{
cout << "\n***** other... ******[" << file.path().filename().string() << "]\n";
}
}
};
int main()
{
const string start_dir = R"(C:\Program Files)";
try
{
listFilesRecursively(start_dir, ".dll");
}
catch(exception& e)
{
cerr << e.what();
}
}