Walkthrough a Directory
Read dir: readdir()
If you need to parse a directory: list all files, retrieve all files (including hidden files) etc, you can use the readdir()
function.
NOTE:
- it needs to be used with
opendir()
andclosedir()
; - it doesnβt return all the files immediately but one by one, so you need to loop through the
readdir()
results