private void GetPathItems(DirectoryEntryInfo parent, bool recurse, bool nameOnly, ReturnContainers returnContainers) { foreach (DirectoryEntryInfo child in parent.GetChildren()) { WriteEntryInfo(child, nameOnly); if (recurse) { GetPathItems(child, recurse, nameOnly, returnContainers); } } }