I'm finding a way to fetch all the subfolders in a known folder, and open them, then keep finding all the subfolders in that folder, keep opening them until there aren't any subfolders left more, then move to another folder in C++. Thanks for help!
Asked
Active
Viewed 146 times
0
-
4IMHO, this is too broad for a SO question. If your environment support C++17 or above, you can use the [`std::filesystem`](https://en.cppreference.com/w/cpp/filesystem) library. Else you can find it in boost. If neither is an option, you will have to use OS specific calls. – Serge Ballesta Sep 24 '21 at 11:08
-
Thanks for helpful tips are are welcome, but don't forget to accept and/or upvote the answer. It took someone's time and effort to write it for you, just for free. – zkoza Oct 01 '21 at 21:59
1 Answers
1
Following up on Serge Ballesta's comment.
If you can compile c++17, then make use of std::filesystem.
- This SO provides a solution to 'LS' a specific dir. Need to add recursion.
However, if you are not able to run c++17, then you need to consider the OS you are working on.
If Linux and using GCC, use native "dirent.h"
- SO post with solution.
- Just need to #include dirent.h
If Windows, can use either windows.h or use a popular libarary extension of dirent.h for windows.

Frebreeze
- 202
- 3
- 10