You can get a list of solutions if you google it with, say, "read all files in directory c++".
For future reference:
What if we don't know how to do some low level (compared with applications) stuff with directory, file system, hard disk, etc?
One possible source is opensource operating systems.
For this particualr example, if you check out the source code for ls command in Linux, you may search for option -a to quickly locate the part of code that list all directory items. Then just follow the program control flow and see how people do the task.