Articles → CSHARP → Get The List Of Files In A Folder Using C#
Get The List Of Files In A Folder Using C#
Folder
Click to Enlarge
Code
using System;
using System.IO;
namespace GetAllFilesDemo {
class Program {
static void Main(string[] args) {
string[] files = Directory.GetFiles(@ "c:\tmp");
foreach(string file in files) {
Console.WriteLine(Path.GetFileName(file));
}
Console.ReadLine();
}
}
}
Output
Click to Enlarge