In this blog, we will create a c# program that prints a list of all files from a particular directory with the file name.

Get Files List From Directory In C Sharp


 

Files In Directory


Get Files List From Directory In C Sharp



Code




Explanation

  • In above code we get directory/ folder info by passing our folder path in DirectoryInfo Constructor.
  • Then we create an array of FileInfo and get all files which are in our directory by our variable d.
  • Then iterate that FileInfo array and print file name one by one.

Output

 


Get Files List From Directory In C Sharp