如果我有如下目录结构并且前缀是/folder1,
/folder1/folder11/folder12/folder13/*.files
/folder21/folder22/folder23/*.files
/folder31/folder32/*.files
我想动态循环遍历这些目录,以便分别读取每个叶子文件夹中的文件,即我需要一个列表
[
/folder1/folder11/folder12/folder13/,
/folder1/folder21/folder22/folder23/,
/folder1/folder31/folder32/
]
除了递归遍历每个前缀、获取下一级前缀、连接、获取下一级等,直到到达最后一个(叶)文件夹,还有更好的方法来获取它吗?