how to get all files in a directory and its sub directories c# code example
Example 1: c# list all files in a directory and subdirectory
string[] allfiles = Directory.GetFiles("path/to/dir", "*.*", SearchOption.AllDirectories);
Example 2: get all files in all subdirectories c#
Directory.GetFiles(dirPath, "*", SearchOption.AllDirectories)