Problem with finding folder in C:\ driver in C++

Viewed 114

My code is shown below. I want to iterate a C:\ drive entirely; however, the output does not have the folders, "Users", "Windows", etc. There are only these:

C:\$SysReset
C:\$WINDOWS.~BT
C:\$Windows.~WS
C:\$WinREAgent
C:\Config.Msi
C:\Documents and Settings
#include <windows.h>
#include <iostream>
#include <filesystem>
#include <string>

int main()
{
    for (const auto& el : std::filesystem::directory_iterator
    (L"C:\\", std::filesystem::directory_options::follow_directory_symlink |
        std::filesystem::directory_options::skip_permission_denied))
    {
        std::string filess = el.path().string();

        if (filess.find("$Recycle.Bin") != std::string::npos)
            continue;
        if (is_directory(el))
            std::cout << el.path().string() << std::endl;
    }
}

I want to know the reason of such output and why there is no "Users" folder.

0 Answers
Related