有没有办法检查一个文件夹是否包含子文件夹? [英] Is there a way to check if a folder contains subfolders?
本文介绍了有没有办法检查一个文件夹是否包含子文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有办法检查一个文件夹是否包含子文件夹,但不使用 FindFirst / FindNext
来检查每个项目,因为当文件夹包含许多文件,并没有子文件夹。
解决方案
我认为一般情况下没有办法问一个文件系统对象,如果它包含任何目录。我想你需要枚举对象的子元素,例如调用 FindFirstFile
, FindNextFile
等。
I want to know if there is a way to check if a folder contains subfolders, but without using the FindFirst/FindNext
to check every item, because it's slow when the folder contains many files and no subfolders.
解决方案
I think in general there is no way to ask a file system object if it contains any directories. I think you need to enumerate the object's children as you have described, for instance with calls to FindFirstFile
, FindNextFile
etc.
这篇关于有没有办法检查一个文件夹是否包含子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文