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

问题描述

大家好,

谁能告诉我如何通过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:

推荐答案

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

        }



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

06-27 09:01