Walk a directory/Recursively: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|C}}: added C++)
Line 138:
return 0;
}</lang>
 
=={{header|C++}}==
{{libheader|boost}}
 
<lang cpp>
#include "boost/filesystem.hpp"
#include "boost/regex.hpp"
#include <iostream>
 
using namespace boost::filesystem;
 
int main()
{
path current_dir("."); //
boost::regex pattern("a.*"); // list all files starting with a
for (recursive_directory_iterator iter(current_dir), end;
iter != end;
++iter)
{
std::string name = iter->path().leaf();
if (regex_match(name, pattern))
std::cout << iter->path() << "\n";
}
}
</lang>
 
=={{header|D}}==