0

So this is the stucture of the folders

ParentFolder ->1.png
             ->2.png
             ->ChildFolder->3.png
                          ->4.png

What the Input/Output I want would look like

input 

1 
2 

output 

1.png    //case1 : getname under folder
2.png

1.png    //case2 : getname under the whole directory
2.png
3.png
4.png

I orignally considered using system(), but using DIR/B only get the parent folder names and I dont know how to store the information , even if I do figure it out, the DIR/S gets me a different format and I dont really know how to deal with it

Other function I've considered using is CStdioFile but that seems to be for modifing files?
opendir but #include <dirent.h> seems to be not working

The Code Structure in my mind

int main(){

   String path = "C:\Users\User\Desktop\ParentFolder"//How would I store list from this folder?
   vector<string> caseOne;

   while(there is next file)//pseudocode
      caseOne.push_back();//This is where I should read in files

   caseOne.push_back();
   for (int a=0;a<caseOne.size();a++)//printout the results
      cout<< caseOne.at(a) <<endl;
}
Mochideer
  • 35
  • 8
  • https://en.cppreference.com/w/cpp/filesystem/recursive_directory_iterator – sweenish Dec 17 '21 at 04:14
  • Look at [`std::filesystem:directory_iterator`](https://en.cppreference.com/w/cpp/filesystem/directory_iterator) and [`std::filesystem::recursive_directory_iterator`](https://en.cppreference.com/w/cpp/filesystem/recursive_directory_iterator) – Remy Lebeau Dec 17 '21 at 05:25
  • Thx guys, exactly what I needed. – Mochideer Dec 17 '21 at 09:26

0 Answers0