C# Directory GetDirectories(String)
Description
Directory GetDirectories(String)
Gets the names of
subdirectories (including their paths) in the specified directory.
Syntax
Directory.GetDirectories(String)
has the following syntax.
public static string[] GetDirectories(
string path
)
Parameters
Directory.GetDirectories(String)
has the following parameters.
path
- The path for which an array of subdirectory names is returned.
Returns
Directory.GetDirectories(String)
method returns
Example
The following example takes an array of file or directory names on the command line, determines what kind of name it is, and processes it appropriately.
using System;//from w w w.j a v a 2s . c o m
using System.IO;
using System.Collections;
public class RecursiveFileProcessor
{
public static void Main(string[] args)
{
string [] subdirectoryEntries = Directory.GetDirectories(".");
foreach(string subdirectory in subdirectoryEntries)
Console.WriteLine(subdirectory);
}
}