FSO C#读取文件夹下面的全部文件夹

private void button1_Click(object sender, EventArgs e)
        {
            string QQPath;
            using (RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"Software\Tencent\QQ"))
            {
                 QQPath = reg.GetValue("Install").ToString();
            }

            textBox1.Text = QQPath;

            Get_Folder(QQPath);
        }

        private void Get_Folder(string FilePath)
        {
            if (Directory.Exists(FilePath))
            {
                foreach (string d in Directory.GetFileSystemEntries(FilePath))
                {
                    if (Directory.Exists(d))
                    {
                       listBox1.Items.Add(d.ToString());
                    }
                }

            }
            else
            {
                MessageBox.Show("文件夹不存在!");
            }
        }

posted @ 2008-10-23 10:41  Landy_di  阅读(304)  评论(0)    收藏  举报