Asp.net gets all file names and file paths with the suffix '.doc 'in the specified directory

  • 2020-05-12 02:27:20
  • OfStack

c# core code:
 
DirectoryInfo dir = new DirectoryInfo(strPath); 
foreach (FileInfo fi in dir.GetFiles("*.doc")) 
{ 
if (fi.FullName.EndsWith(".doc")) //  will  docx  Type files are filtered out  
{ 
//  this  fi  That's what you want  doc  file  
Console.WriteLine(fi.Name); 
} 
} 

Related articles: