findFiles

Finds matching files in a directory.

string[]
findFiles
(
string dir
,
string pattern
,
bool recursive = true
,
int maxDepth = -1
)

Parameters

dir string

The directory to search in.

pattern string

A regex pattern to match against each filename.

recursive bool

Whether to recursively search subdirectories.

maxDepth int

How deep to search recursively. -1 indicates infinite recursion.

Return Value

Type: string[]

A list of matching filenames.

Meta