How can I use pathlib to recursively iterate over all subdirectories of a given directory?
p = Path(\'docs\') for child in p.iterdir(): child
pathlib has glob method where we can provide pattern as an argument.
pathlib
glob
For example : Path('abc').glob('**/*.txt') - It will look for current folder abc and all other subdirectories recursively to locate all txt files.
Path('abc').glob('**/*.txt')
abc
txt