How do I get the absolute paths of all the files in a directory that could have many sub-folders in Python?
I know os.walk() recursively gives me a list
os.walk()
Try:
from pathlib import Path path = 'Desktop' files = filter(lambda filepath: filepath.is_file(), Path(path).glob('*')) for file in files: print(file.absolute())