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("文件夹不存在!");
}
}

浙公网安备 33010602011771号