ferencd@0: #include "templater.h" ferencd@0: ferencd@0: #include ferencd@0: #include ferencd@0: ferencd@0: #define BOOST_FILESYSTEM_NO_DEPRECATED ferencd@0: #define BOOST_FILESYSTEM_VERSION 3 ferencd@0: ferencd@0: #include ferencd@0: #include "boost/filesystem.hpp" ferencd@0: ferencd@0: using namespace std; ferencd@0: using namespace boost::filesystem; ferencd@0: ferencd@0: int main(int argc, char *argv[]) ferencd@0: { ferencd@0: // list all files in current directory. ferencd@0: //You could put any file path in here, e.g. "/home/me/mwah" to list that directory ferencd@0: path p (TEMPLATES_DIRECTORY); ferencd@0: ferencd@0: directory_iterator end_itr; ferencd@0: ferencd@0: // cycle through the directory ferencd@0: for (directory_iterator itr(p); itr != end_itr; ++itr) ferencd@0: { ferencd@0: // If it's not a directory, list it. If you want to list directories too, just remove this check. ferencd@0: if (is_regular_file(itr->path())) { ferencd@0: // assign current file name to current_file and echo it out to the console. ferencd@0: string current_file = itr->path().string(); ferencd@0: cout << current_file << endl; ferencd@0: } ferencd@0: } ferencd@0: }