Simple recursive file scan
This may not be the most orthodox way to scan a directory, but it's useful for logging files throughout the scan.
using System.IO;
static void ScanDir(string dir)
{
try
{
foreach (string d in Directory.GetDirectories(dir))
{
foreach (string file in Directory.GetFiles(d))
{
//Log each file path
Console.WriteLine(file);
}
//Scan next directory
ScanDir(d);
}
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Written by Raxdiam
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#C#
Authors
Related Tags
#c#
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#