For this problem, you should use a recursive method like this:
public void ProcessDirectory(string directory)
{
var files = Directory.GetFiles(directory);
foreach (var fileName in files)
{
}
var subDirectories = Directory.GetDirectories(directory);
if (subDirectories.Length > 0)
{
foreach (var subDirectory in subDirectories)
{
ProcessDirectory(subDirectory);
}
}
}
and only get the files for the current directory (and cycle over all sub-directories).
Hope this helps.
Best regards,
Stops