I have a function that currently captures all folders and subfolders to check the ACL for a small tool that I create, but I am pulling my hair out trying to figure out how to limit the depth, go to. For example, you have a folder with 4 depth levels, but I want to be able to capture only 3 levels for the ACL.
I am currently encoded this way:
private void StepThroughDirectories(string dir) { string[] directories = Directory.GetDirectories(dir); try { foreach (string d in Directory.GetDirectories(dir)) { if (recCount < (int)Depth) { GetACLs(d, new DirectoryInfo(d)); pBar.Value += 1;
Obviously, this is not so pleasant because I have been working on a problem for some time, but if someone can point me in the right direction to solve this problem, I would be very happy!
list c # directory recursion subdirectories
Jeff bolduan
source share