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()
If you have Python 3.4 or newer you can use pathlib (or a third-party backport if you have an older Python version):
import pathlib for filepath in pathlib.Path(directory).glob('**/*'): print(filepath.absolute())