string[] allfiles = Directory.GetFiles("path/to/dir", "*.*", SearchOption.AllDirectories);
where *.*
is pattern to match files
If the Directory is also needed you can go like this:
foreach (var file in allfiles){
FileInfo info = new FileInfo(file);
// Do something with the Folder or just add them to a list via nameoflist.add();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…