Share via


Directory.GetFiles Method

Returns the names of files in a specified directory.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

public static string GetFiles (
         string path,
         string searchPattern
)

Parameters

  • path
    The directory to search.
  • searchPattern
    The search string to match against the names of files in path. The parameter cannot end in two periods ("..") or contain two periods ("..") followed by DirectorySeparatorChar or AltDirectorySeparatorChar, nor can it contain any of the characters in InvalidPathChars.

Return Value

A String array containing the names of files in the specified directory that match the specified search pattern.

Version Information

Available in the .NET Micro Framework versions 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

Directory Class
Directory Members
System.IO Namespace