recursive_directory_listing (function)

fundamentals.files.recursive_directory_listing(log, baseFolderPath, whatToList='all')[source][source]

list directory contents recursively.

Options to list only files or only directories.

Key Arguments

  • log – logger

  • baseFolderPath – path to the base folder to list contained files and folders recursively

  • whatToList – list files only, directories only or all [ “files” | “dirs” | “all” ]

Return

  • matchedPathList – the matched paths

Usage

```python from fundamentals.files import recursive_directory_listing theseFiles = recursive_directory_listing(

log, baseFolderPath=”/tmp”

)

# OR JUST FILE

from fundamentals.files import recursive_directory_listing theseFiles = recursive_directory_listing(

log, baseFolderPath=”/tmp”, whatToList=”files”

)

# OR JUST FOLDERS

from fundamentals.files import recursive_directory_listing theseFiles = recursive_directory_listing(

log, baseFolderPath=”/tmp”, whatToList=”dirs”

) print theseFiles ```