Demo Example for Path Object
Explore how to use C++17's filesystem path object through a demo that lists all files within directories recursively. Understand how to read directory contents, check file types, obtain file sizes, and handle paths using modern C++ filesystem API.
We'll cover the following...
We'll cover the following...
Demo
Instead of exploring the library piece by piece at the start, let’s see a demo example: displaying basic information about all the files in a given directory (recursively). This should give you a high-level overview of how the library looks like.
Sample Outputs
We can run this program on a temp path D:\testlist and see the following output:
Running on Windows:
.\ListFiles.exe D:\testlist\
listing files in the directory: D:\testlist\
abc.txt, size 357 bytes
def.txt, size 430 bytes
ghi.txt, size 190 bytes
dirTemp
jkl.txt, size 162 bytes
mno.txt, size ...