get_directory_data

get_directory_data(target_path)

Walks the directory and builds a representative list of dictionaries of all children. Uses os.walk to capture every file and folder.

Parameters

Name Type Description Default
target_path str The root directory path from which to start building the data. required

Returns

Name Type Description
list of dict A list of dictionaries representing files and folders with their sizes and hierarchy.

Examples

>>> data = get_directory_data(".")
>>> isinstance(data, list)
True