1. 没有后缀名的限制:
string[] filePaths = Directory.GetFiles(@"c:MyDir");
2. 有后缀名:
string[] filePaths = Directory.GetFiles(@"c:MyDir", "*.bmp");
3. 获取文件夹以及子文件夹里面的所有文件: 设置SearchOption.AllDirectories 属性
string[] filePaths = Directory.GetFiles(@"c:MyDir", "*.bmp",
SearchOption.AllDirectories);
Further information: