I am currently using a directory iterator to read through an entire directory, and it does it well because it reads through every file in any sub folder in the directory.
Is there a way to know when it has hit the end of the sub folder and will be going back to the main folder of the dir to start the next one?
for example, if my directory has:
mainFOLDER>SUBFOLDER>ANOTHERSUB(this is the end)
mainFOLDER>difSUBFOLDER> so on so on
mainFOLDER> whatever
How do I know when its hits "anothersub".
if (std::filesystem::is_directory(r)) {
fs::path path = r.path();
std::string path_string = path.u8string();
if (inside == false) {
parentDir = path_string;
}
double clests = processDir(path_string,inside);
if (clests != -1) {
string newString = to_string(clests);
finishedPaths.push_back(newString + " " + parentDir);
}
}
else if (std::filesystem::is_regular_file(r)) {
fs::path path = r.path();
std::string path_string = path.u8string();
double File = processFile(path_string);
if (File != -1) {
string newString = to_string(File);
newString = newString + " " + path_string;
finishedPaths.push_back(newString);
}
}
}