Reputation: 181
I wish to list the subdirectories of a given directory so I am using Directory.GetDirectories(string)
. Everything works fine but I don't see "." and ".." in the return array. Those two shouldn't be there?
Upvotes: 0
Views: 195
Reputation: 35353
Suppose you call as Directory.GetDirectories(path);
then
.
is the path
and
..
is the new DirectoryInfo(path).Parent.FullName
Upvotes: 2
Reputation: 20620
GetDirectories only returns sub-directories. Not the parent directory, not the current directory.
Documentation:
Return Value
Type: System.String[]
An array of the full names (including paths) of subdirectories in the specified path.
Upvotes: 2