Augus tin

Augus tin

  • NA
  • 166
  • 6.4k

How to check if there is any directory available or not

Dec 7 2018 2:56 AM
Hello Team !
 
          I have strucked from past 4hrs because of this as my question is
 
How to check if there is any directory available or not
 
actually i am using a code to check the directory but boolean always return false  so i can't predict my logic kindly help me to fix this dear
 
Here is my code
 
bool isEmpty = false ;
isEmpty = !Directory.EnumerateFiles(voicefile + "\\").Any(); //check there is an folder
if (isEmpty)
{
foldernamevoice = objdirinfovikramgetfile + "" + getvoicefilesvikramfolder[0];
DirectoryInfo objdirinfovikramgetfilefolderfile = new DirectoryInfo(foldernamevoice);
if (objdirinfovikramgetfilefolderfile.Exists) //if folder exist
{
//get voice file name list
getvoicefilesvikram = objdirinfovikramgetfilefolderfile.GetFiles("*.*").Select(y => y.FullName + "#" + y.Name).Where(s => s.EndsWith(".dss") || s.EndsWith(".ds2") || s.EndsWith(".mp3") || s.EndsWith(".wav") || s.EndsWith(".dct") || s.EndsWith(".m4a") || s.EndsWith(".wma") || s.EndsWith(".DSS") || s.EndsWith(".DS2") || s.EndsWith(".MP3") || s.EndsWith(".WAV") || s.EndsWith(".DCT") || s.EndsWith(".M4A") || s.EndsWith(".WMA"));
folderfile = getvoicefilesvikramfolder[0];
}
}
 

Answers (3)