In short:
To
list all the files in a folder or directory using the .NET Framework's methods in the
System.IO
namespace and the C# programming language, the framework provides powerful methods on the Directory class that can help you list files on the filesystem. The
Directory.GetFiles
method allows you to get a string array of the file names.
Please refer:
C# Directory.GetFiles[
^]
This example shows how to get list of file names from a directory (including
subdirectories). You can
filter the list by specific extension.
Get Files from Directory [C#][
^]