我有这个代码从文件夹中读取数据。我也想从子文件夹中读取数据,逐个处理文件夹太麻烦了。你能帮帮我吗?
这是我的代码:
private void btnSource_Click(object sender, EventArgs e)
{
fbdSourceMDATA.Description = "Please select MDATA source folder";
fbdSourceMDATA.RootFolder = Environment.SpecialFolder.Desktop;
if ((fbdSourceMDATA.ShowDialog() != DialogResult.Cancel) |(fbdSourceMDATA.SelectedPath != ""))
{
sourceMDATA = fbdSourceMDATA.SelectedPath;
if (File.Exists(sourceMDATA + "\\Master"))
{
txtSourceMDATA.Text = fbdSourceMDATA.SelectedPath;
Interaction.SaveSetting ((new Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase()).Info.Title ,
"RealTime Converter", "sourceMDATA", fbdSourceMDATA.SelectedPath);
}
else
{
}
FETALIBLib.FLReader Reader = new MFTALIBLib.FLReader();
Reader.OpenDirectory(txtSourceMDATA.Text);
Reader.ReadMaster();
lbmainMDATA.Items.Clear();
}
}
答案 0 :(得分:0)
如果要获取子文件夹列表,请查看System.IO.Directory.GetDirectories