Get Files from Directory [C#]
This example shows how to get list of file names from a directory (includingsubdirectories).
You can filter the list by specific extension.
To get file names from the specified directory, use static method
Lets have these files andsubfolders in „c:\MyDir“ folder:
Get files from directory
Method Directory.GetFiles returns string array with files names (fullpaths).
[C#]
richTextBox1.AppendText(f + "\r\n");
Get files from directory (with specified extension)
You can specify search pattern. You can use wildcard specifiers in the searchpattern,
e.g. „*.bmp“ to select files with the extension or „a*“ toselect files beginning with letter „a“.
[C#]
richTextBox1.AppendText(f + "\r\n");
Get files from directory (including all subdirectories)
If you want to search also in subfolders use parameterSearchOption.AllDirectories.
[C#]
richTextBox1.AppendText(f + "\r\n");