Do any POSIX functions or glibc extensions implement a breadth-first file tree walk?

淺唱寂寞╮ 提交于 2019-12-05 21:36:54

Looking at the spec for 'nftw()', the FTW_DEPTH flag does a post-order (depth first) traversal, visiting the sub-directories before visiting the directory node.

I don't think any of the standard algorithms do a breadth-first search.

Presumably, you should write a bfftw() based on the nftw() interface. Note that you have to queue the items to be visited recursively (directories) while doing the scan.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!