NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Directory.GetFilesInDirectory (String, String)

Retrieves an array of files matching the specified search criteria from the specified directory.

[Visual Basic]
Overloads Public Shared Function GetFilesInDirectory( _
   ByVal path As String, _
   ByVal searchCriteria As String _
) As File ()
[C#]
public static File[] GetFilesInDirectory(
   string path,
   string searchCriteria
);
[C++]
public: static File* GetFilesInDirectory(
   String* path,
   String* searchCriteria
) [];
[JScript]
public static function GetFilesInDirectory(
   path : String,
   searchCriteria : String
) : File[];

Parameters

path
The directory from which to return files.
searchCriteria
The search string, such as "*.txt".

Return Value

An array of files matching the specified search criteria from the specified directory.

Exceptions

Exception Type Condition
ArgumentNullException searchCriteria is a null reference (in Visual Basic Nothing).
ArgumentException path is a null reference (Nothing), the directory name is empty, or it contains only whitespaces.
SecurityException The caller does not have the required permission.

Remarks

".." can only be used in searchCriteria if it is specified as a part of a valid file or directory name. It cannot be used to move up the directory hierarchy. For example:

a..b abc..d is valid.

..ab ab.. .. abc..d\abc.. is invalid.

Other wild card characters are allowed in searchCriteria. For example, a search string such as "System*" would match both the System and System32 directories.

Requirements

NGWS Runtime Security:

FileIOPermissionAccess Read flag required for read permission to the path.

See Also

Directory Class | Directory Members | System.IO Namespace | Directory.GetFilesInDirectory Overload List