Click here to Skip to main content
15,918,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
Posted

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
        
        }
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900