Click or drag to resize

DirectoryInfoGetFileSystemInfos(String) Method

Retrieves an array of strongly typed FileSystemInfo objects representing the files and subdirectories matching the specified search criteria.

Namespace: Crestron.SimplSharp.CrestronIO
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public FileSystemInfo[] GetFileSystemInfos(
	string searchPattern
)

Parameters

searchPattern  String
The search string, such as "System*", used to search for all directories beginning with the word "System".

Return Value

FileSystemInfo
An array of strongly typed FileSystemInfo objects matching the search criteria.
Exceptions
ExceptionCondition
InvalidDirectoryLocationExceptionInvalid directory specified.
DirectoryNotFoundExceptionThe current directory does not Exist.
ArgumentNullExceptionThe path is null.
SecurityExceptionThe user does not have the correct permissions.
Example
using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO;; public class FileSystemInfosWithSearch { public static void Main() { try { // Create a reference to a directory. DirectoryInfo dir = new DirectoryInfo("MyDirectory"); string searchString = "app"; if (dir.Exists) { // Call the GetFileSystemInfos method. FileSystemInfo[] infos = dir.GetFileSystemInfos(searchString); //Display the results to the console. CrestronConsole.Print("SubDirectories and files that include {0} \r\n",searchString); foreach( FileSystemInfo f in infos) { CrestronConsole.Print("SubDirectories and files: {0} , ", f.FullName); } } } catch (Exception Ex) { CrestronConsole.Print("Unable to access directory '{0}'", _diretoryInfo.FullName); } return }

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also