private void button1_Click(object sender, EventArgs e) { foreach (string file in GetFiles("C:\\")) { // Console.WriteLine(file); listBox2.Items.Add(file); } } static IEnumerable<string> GetFiles(string path) { Queue<string> queue = new Queue<string>(); queue.Enqueue(path); while (queue.Count > 0) { path = queue.Dequeue(); try { foreach (string subDir in Directory.GetDirectories(path)) { queue.Enqueue(subDir); } } catch (Exception ex) { MessageBox.Show("ex"); Console.Error.WriteLine(ex); } string[] files = null; try { files = Directory.GetFiles(path); } catch (Exception ex) { Console.Error.WriteLine(ex); } if (files != null) { for (int i = 0; i < files.Length; i++) { yield return files[i]; } } } }
Quote:These junction points can be identified as follows: •They have the FILE_ATTRIBUTE_REPARSE_POINT, FILE_ATTRIBUTE_HIDDEN, and FILE_ATTRIBUTE_SYSTEM file attributes set. •They also have their access control lists (ACLs) set to deny read access to everyone.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)