I know that glob exists for this purpose and one can also use os.walk to get a list of all subdirectories and files inside a folder and use this to create a tree of all files and folders that exist inside a root directory. However, can one also use the Pathlib iterdir function to recursively iterate through all subdirectories inside a folder and store the paths to all files and the filenames like we can do so easily with os.walk?
I am asking this question since as per my knowledge, the Pathlib actually presents better way to do things already done by os and os.path.