Apr 5, 2024
Everything you write is correct, but also, really old-school. ๐
98 times out of 100, when you're doing file and path manipulation, you should be using pathlib
!
For example, to print all .txt files below a given directory, use pathlib.Path.glob
:
from pathlib import Path
print(*Path('folder1').glob('**/.txt'))