I need an if statement to check whether a folder contains files. I have tried a few things but i cannot get it to work if there are files within a subfolder in the root folder. Do i have to have a loop to look in the subfolders? Here's what i have so far:
if(Directory.GetDirectories(oldDir).Length == 0 && Directory.GetFiles(oldDir).Length == 0)
{
//do this
}
I was hoping it would pick up folders that doesn't contain any file in it. (weather it has a subfolder or not)
Aucun commentaire:
Enregistrer un commentaire