A quick and dirty method (not necessarily recommended therefore) to get all files and folders of a drive is to using the dir /s command of the Windows command interpreter cmd and redirect the output of that command to a file.
// assume the drive letter is x
system("dir /s /b x:\*.* > xxx.txt");
while (getline(xxx, line))
std::cout << line << std::endl;