how to read dat files in sub folders
I have this code that reads the data from a folder.I want to read data from the sub folders too, it is too cumbersome to process the folders one by one. Can you help me with that?
Here is my 开发者_JAVA百科code:
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();
}
}
If you want to get a list of sub folders then look at System.IO.Directory.GetDirectories
精彩评论