计算文件夹内的文件夹数量
有谁知道我可以用来计算指定目录中文件夹数量的代码?
Does anyone know a code I can use to count the number of folders in a specified directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有谁知道我可以用来计算指定目录中文件夹数量的代码?
Does anyone know a code I can use to count the number of folders in a specified directory?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
我所知道的最简单的代码使用来自 IOUtils 单元的 TDirectory:
TDirectory.GetDirectories 实际上返回一个包含目录名称的动态数组所以这有点低效。如果您想要最有效的解决方案,那么您应该使用
FindFirst
进行枚举。The very simplest code that I know of uses
TDirectory
from theIOUtils
unit:TDirectory.GetDirectories
actually returns a dynamic array containing the names of the directories so this is somewhat inefficient. If you want the most efficient solution then you should useFindFirst
to enumerate.