In the boost documentation I found the code to list a directory files AND folders (but not recursively :( ), but I don't know how to do to generate only the list of all files, even those that are in the sub directories (recursively) OR the list of all folders (recursively too).
To get you started:
#include <boost/filesystem.hpp>
#include <boost/range/iterator_range.hpp>
namespace fs = boost::filesystem;
#include <iostream>
int main() {
for (auto& entry : boost::make_iterator_range(fs::recursive_directory_iterator("."), {}))
{
if (fs::is_regular_file(entry))
std::cout << entry.path() << "\n";
}
}
Prints e.g.
"./odata/marshal/json_light_test.cpp"
"./odata/marshal/core_test.cpp"
"./odata/marshal/json_verbose_test.cpp"
"./odata/edm/example_test.cpp"
"./odata/edm/builtin_test.cpp"
"./misc/naive_ptr_tests.cpp"
"./json/generic_visitor_tests.cpp"
"./json/json_tests.cpp"
"./azure/storage/test_service_definitions.hpp"
"./azure/storage/blob_tests.cpp"
"./azure/storage/table_tests.cpp"
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments