Directory.GetDirectories
returns only the given path's sub-directories but I would like to list all the subs, and their subs all the way to the end.
I'm thinking of a recursive function, but I am not sure how to approach the problem.
Directory.GetDirectories
returns only the given path's sub-directories but I would like to list all the subs, and their subs all the way to the end.
I'm thinking of a recursive function, but I am not sure how to approach the problem.
Use another Directory.GetDirectories overload.
string[] dirs = Directory.GetDirectories(@"c:\data", "*", SearchOption.AllDirectories);
Here is how:
new DirectoryInfo(Assembly.GetExecutingAssembly().Location /* or any other location */)
.EnumerateDirectories("*"/*or any other pattern*/,SearchOption.AllDirectories);
You can modify all arguments as needed.