I am trying to iterate over all the folders in my C:\ directory, and ONLY in the C:\ directory. Not in any subfolders. My current problem is that it includes inaccessible files and folders like swapfile.sys or System Volume Information when iterating. How can I check the flags or whatnot to exclude such objects?
for (const auto& entry : std::filesystem::directory_iterator(dir))
{
// Have the if() check here to see if it's accessible
directory.emplace_back(f);
}