1 // filesystem tut6c.cpp --------------------------------------------------------------// 2 3 // Copyright Beman Dawes 2010 4 5 // Distributed under the Boost Software License, Version 1.0. 6 // See http://www.boost.org/LICENSE_1_0.txt 7 8 // Library home page: http://www.boost.org/libs/filesystem 9 10 #include <iostream> 11 #include <exception> 12 #include <boost/filesystem.hpp> 13 #include <boost/system/error_code.hpp> 14 15 using namespace boost::filesystem; 16 using namespace boost::system; 17 main(int argc,char * argv[])18int main(int argc, char* argv[]) 19 { 20 if (argc < 2) 21 { 22 std::cout << "Usage: tut6c path\n"; 23 return 1; 24 } 25 26 error_code ec; 27 for (recursive_directory_iterator it (argv[1], ec); 28 it != recursive_directory_iterator(); 29 ) 30 { 31 for (int i = 0; i <= it.level(); ++i) 32 std::cout << " "; 33 34 std::cout << it->path() << '\n'; 35 36 it.increment(ec); 37 } 38 39 return 0; 40 } 41