In boost::filesystem library is there any way to determine if the path is directory or file?
My scenario is : I have some folders and files which i need full path of the all files and push it to vector, so i did this :
for ( boost::filesystem::recursive_directory_iterator end, dir(pathBase);
dir != end; ++dir ) {
if ( boost::filesystem::exists( dir->path() ) )
{
std::cout << dir->path() << "\n"; // full path
filenames.push_back(dir->path().string());
}
}
The problem is the exists method check if directory or file exist and could not detect their type(file or directory).
So how can i get only files with boost library?
This sounds like you need boost::filesystem::is_regular_file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With