public partial class MainWindow : Window
{
    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        string sourcePath = @"C:\MasterPageArtifacts\";            
        static void DirSearch(string sourcePath)
        {
            try
            {
                foreach (string d in Directory.GetDirectories(sourcePath))
                {
                    foreach (string f in Directory.GetFiles(d))
                    {
                        listBox1.Items.Add(f);
                    }
                    DirSearch(d);
                }
            }                      
            catch (Exception ex)
            {
                listBox1.Items.Add(ex.Message);
            }
        }
    }
} 
No comments:
Post a Comment