Boost logo

Boost Users :

From: Lawrence Spector (Lawrence.Spector_at_[hidden])
Date: 2007-10-02 14:25:23


Here's a simple example. Is there a way to do achieve this effect?

            std::string folderName = "C:\\*.sys";

            boost::filesystem::path fsDirectoryPath =
                  boost::filesystem::system_complete(
                        boost::filesystem::path(folderName, boost::filesystem::native));

            boost::filesystem::directory_iterator end_iter;

            for (boost::filesystem::directory_iterator dir_itr(fsDirectoryPath);
                  dir_itr != end_iter; ++dir_itr) // throws exception
            {
                  std::cout << "Contains the following file: " << dir_itr->string() << std::endl;
            } // end for

When I do this, I get the following exception:

boost::filesystem::basic_directory_iterator constructor

I don't see any documentation for how to narrow your searches with wildcards or how to only find files that match a particular file name. Am I missing something? Obviously you can refine your search later in the loop, but that is inefficient.

Please let me know.

Thanks,

Lawrence



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net