How can I use pathlib to recursively iterate over all subdirectories of a given directory?
p = Path(\'docs\')
for child in p.iterdir(): child
To find just folders the right glob string is:
'**/'
So to find all the paths for all the folders in your path do this:
p = Path('docs')
for child in p.glob('**/'):
print(child)
If you just want the folder names without the paths then print the name of the folder like so:
p = Path('docs')
for child in p.glob('**/'):
print(child.name)