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);
}
}
}
}
Search This Blog
Thursday, April 13, 2017
Recursively walking through a directory tree and listing file names
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment