Skip to content

Instantly share code, notes, and snippets.

@gergoszka
Created October 9, 2019 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergoszka/8fe853fe4c93335d77175337f45a1202 to your computer and use it in GitHub Desktop.
Save gergoszka/8fe853fe4c93335d77175337f45a1202 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <map>
#include <iomanip>
#include <fstream>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/program_options.hpp>
using std::cout;
using namespace boost::filesystem;
void read_acts ( path p)
{
std::vector<path> v;
if ( is_regular_file ( p ) ) {
std::string ext ( ".java" );
for (auto&& x : directory_iterator(p))
{
if ( !ext.compare ( extension ( p ) ) )
{
v.push_back(x.path());
}
}
} else if ( is_directory ( p ) )
for ( directory_entry & entry : boost::filesystem::directory_iterator ( p ) )
read_acts ( entry.path());
for (auto&& x : v)
cout << " " << x.filename() << '\n';
}
int main ( int argc, char *argv[] )
{
if (argc < 2)
{
cout << "Usage: tut4 path\n";
return 1;
}
path p (argv[1]);
read_acts(p);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment