fundamentals.files.recursive_directory_listing¶
List the contents of a directory recursively
- Author
David Young
Module Contents¶
Functions¶
list directory contents recursively. |
API¶
- fundamentals.files.recursive_directory_listing.recursive_directory_listing(log, baseFolderPath, whatToList='all')[source][source]¶
list directory contents recursively.
Options to list only files or only directories.
Key Arguments
log– loggerbaseFolderPath– path to the base folder to list contained files and folders recursivelywhatToList– list files only, directories only or all [ “files” | “dirs” | “all” ]
Return
matchedPathList– the matched paths
Usage
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