def scan_tree(path: str):
"""Recursively scan a directory tree and yield an os.DirEntry object.
Args:
path: The path of the directory to scan.
Yields:
An os.DirEntry object for each file in the tree.
"""
for entry in os.scandir(path):
yield entry
if entry.is_dir(follow_symlinks=False):
yield from scan_tree(entry.path)
评论列表
文章目录