#include #include #include using namespace std; using namespace boost; using namespace boost::filesystem; static void Process_Files(const path & Path, bool recurse) { cout << "Processing folder " << Path.native_file_string() << "\n"; directory_iterator end_itr; // default construction yields past-the-end for (directory_iterator itr(Path); itr != end_itr; ++itr) { if (recurse && is_directory(*itr)) { // Погружаемся на 1 уровень вниз по дереву каталогов path Deeper(*itr); Process_Files(Deeper, recurse); continue; } // Файл, путь к которому содержится в filename, можно обрабатывать. string filename = itr->file_string(); cout << filename << "\n"; } return; } int main(int argc, char *argv[]) { bool recurse = true; // обходить ли каталоги Process_Files(current_path(), recurse); return 0; }