DirectoryInfoGetFileSystemInfos(String) Method |
Retrieves an array of strongly typed
FileSystemInfo objects representing
the files and subdirectories matching the specified search criteria.
Namespace: Crestron.SimplSharp.CrestronIOAssembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntaxpublic 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
FileSystemInfoAn array of strongly typed
FileSystemInfo objects matching the search criteria.
Exceptions
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