This question has already been answered:
I do this search in folders
{ treeView1.Nodes.Clear(); try { foreach (string find in Directory.GetFiles(catalog, fileName, SearchOption.AllDirectories)) { fileCount++; label6.Text = "Файлов обработано: " + fileCount; label4.Text = "Обработка: " + find; treeView1.Nodes.Add("" + find); } } catch { treeView1.Nodes.Add("123"); } fileCount = 0; } Naturally, in many cases, Exception climbs after which the folder search stops. How to continue the search after the eksepshen, or how to make sure that the search is not conducted in the system directories causing the exception?