Method GetFiles
GetFiles(string?, string?)
Gets the names of files (with their paths) that match the specified search pattern in the specified directory.
public static string[] GetFiles(string? path, string? searchPattern)
Parameters
path
stringThe path (relative or absolute) to the directory to search. Value is not case-sensitive.
searchPattern
stringThe search string to match against the names of files in path. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters. Regular expressions are not supported.
Returns
- string[]
An array of the full names (with paths) for the files in the specified directory that match the search pattern, or an empty array if no files are found.