The overloads of the FileSystem.GetFiles method return a read-only collection of strings representing the names of the files within a directory:
Use the GetFiles(String) overload for a simple file search in a specified directory, without searching subdirectories.
Use the GetFiles(String, SearchOption, String[]) overload to specify additional options for your search. You can use the wildCards
parameter to specify a search pattern. To include subdirectories in the search, set the searchType
parameter to SearchOption.SearchAllSubDirectories.
VB.NET podcasts.NET Rocks: Eric Lippert Talks About Project Roslyn Published 9 years ago, running time 0h56m. Recorded on PI day, Carl and Richard talk to the one-and-only Eric Lippert from the C# Compiler team. But we don't only talk about C#! The conversation wanders around all the languages, a little F#, a little IronPython, heck, even VB.NET!
An empty collection is returned if no files matching the specified pattern are found.
Use one of the FileSystem.GetFiles method overloads, supplying the name and path of the directory to search in the directory
parameter. The following example returns all files in the directory and adds them to ListBox1
.
The following conditions may cause an exception:
The path is not valid for one of the following reasons: it is a zero-length string, it contains only white space, it contains invalid characters, or it is a device path (starts with .) (ArgumentException).
The path is not valid because it is Nothing
(ArgumentNullException).
directory
does not exist (DirectoryNotFoundException).
directory
points to an existing file (IOException).
The long wished-for encounter of the X Universe and the Earth holds both joy and sorrow for the people. About This GameIt is the year 2938. Best x3 terran conflict mods.
The path exceeds the system-defined maximum length (PathTooLongException).
A file or directory name in the path contains a colon (:) or is in an invalid format (NotSupportedException).
The user lacks necessary permissions to view the path (SecurityException).
The user lacks necessary permissions (UnauthorizedAccessException).