private void GetFilesRec(ShellObject path) { ShellContainer con = (ShellContainer)ShellContainer.FromParsingName(path.ParsingName); foreach (ShellObject item in con) { try { if (item.IsFolder) { try { GetFilesRec(item); } catch (Exception) { } } else { shol.Add(item); } } catch (Exception) { } } con.Dispose(); }
private void GetAllDirRec(ShellObject path) { AllDirsCount = 0; ShellContainer con = (ShellContainer)ShellContainer.FromParsingName(path.ParsingName); foreach (ShellObject item in con) { try { if (item.IsFolder) { try { AllDirsCount++; GetFilesRec(item); } catch (Exception) { } } } catch (Exception) { } } con.Dispose(); }