Platform Core .NET Assemblies API
EnumerateFiles Method
See Also  Send Feedback
Terrasoft.IO Namespace > IDirectory Interface : EnumerateFiles Method
path
The relative or absolute path to the directory to search. This string is not case-sensitive.
searchPattern
The 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 (see Remarks), but doesn't support regular expressions.
searchOption
One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories. The default value is System.IO.SearchOption.TopDirectoryOnly.

Glossary Item Box

Returns an enumerable collection of file names that match a search pattern in a specified path, and optionally searches subdirectories.

Syntax

 
C#
 
 

Parameters

path
The relative or absolute path to the directory to search. This string is not case-sensitive.
searchPattern
The 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 (see Remarks), but doesn't support regular expressions.
searchOption
One of the enumeration values that specifies whether the search operation should include only the current directory or should include all subdirectories. The default value is System.IO.SearchOption.TopDirectoryOnly.

Return Value

An enumerable collection of the full names (including paths) for the files in the directory specified by path and that match the specified search pattern and option.

Exceptions

ExceptionDescription
System.ArgumentException%path %is a zero-length string, contains only white space, or contains invalid characters. You can query for invalid characters by using the System.IO.Path.GetInvalidPathChars method.- or -searchPattern does not contain a valid pattern.
System.ArgumentNullExceptionpath is null.-or-searchPattern is null.
System.ArgumentOutOfRangeExceptionsearchOption is not a valid System.IO.SearchOption value.
System.IO.DirectoryNotFoundExceptionpath is invalid, such as referring to an unmapped drive.
System.IO.IOExceptionpath is a file name.
System.IO.PathTooLongExceptionThe specified path, file name, or combined exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters.
System.Security.SecurityExceptionThe caller does not have the required permission.
System.UnauthorizedAccessExceptionThe caller does not have the required permission.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© Terrasoft 2002-2018.