查找空文件夹 [英] Finding an Empty Folder

查看:116
本文介绍了查找空文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

谁能告诉我如何通过C#.NET从特定目录中找到一个空文件夹?

例如:
在"DESKTOP"上有一个名为"ABC"的空文件夹,我想通过我的C#.NET代码找到它. :doh:

Hi All,

Can anyone tell me how to find an empty folder from specific directory through C#.NET??

e.g. :
There is one empty folder called "ABC" on ''DESKTOP'' and i want to find it through my C#.NET code. :doh:

推荐答案

尝试一下.

Try this.

string directoryPath = @"C:\TEMP\";
        if (System.IO.Directory.GetDirectories(directoryPath).Length.Equals(0) 
            || System.IO.Directory.GetFiles(directoryPath).Length.Equals(0))
        {
            //Folder is empty do something here
        
        }


看这里:
如何快速检查文件夹是否为空(.NET)? /a> [ ^ ]
Look here:
How to quickly check if folder is empty (.NET)?[^]


这篇关于查找空文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆