if there are any folders in the directory, how would you seek them?
please do have a proper look at the question which says i want to list all the contents of a drive ??
all the members also need a destination ?? without enumerating the contents how would we pass the contents to CFindFIle class?
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.
Code:
// assume the drive letter is x
system("dir /s /b x:\*.* > xxx.txt");
std::ifstream xxx("xxx.txt");
if (xxx)
{
std::string line;
while (getline(xxx, line))
std::cout << line << std::endl;
xxx.close();
remove("xxx.txt");
}
Bookmarks