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[];
An array of files matching the specified search criteria from the specified directory.
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. |
".." 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.
NGWS Runtime Security:
FileIOPermissionAccess | Read flag required for read permission to the path. |
Directory Class | Directory Members | System.IO Namespace | Directory.GetFilesInDirectory Overload List