Returns a file list from the current directory matching the given search criteria, such as "*.txt".
[Visual Basic] Overloads Public Function GetFiles( _ ByVal searchCriteria As String _ ) As File () [C#] public File[] GetFiles( string searchCriteria ); [C++] public: File* GetFiles( String* searchCriteria ) []; [JScript] public function GetFiles( searchCriteria : String ) : File[];
An array of file names.
Exception Type | Condition |
---|---|
ArgumentNullException | searchCriteria is null. |
".." 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.
Directory Class | Directory Members | System.IO Namespace | Directory.GetFiles Overload List