var allfiles = System.IO.Directory.GetFiles(
@"C:\YourFolder",
"*.*",
System.IO.SearchOption.AllDirectories);
foreach (string file in allfiles)
{}
To filter this result, you can add a .Where at the end, the following code will only list audio files:
var allfiles = System.IO.Directory.GetFiles(
@"
C:\YourFolder
",
"*.*",
System.IO.SearchOption.AllDirectories).Where(
s => s.EndsWith(".mp3") ||
s.EndsWith(".wav") ||
s.EndsWith(".wma"));
foreach (string file in allfiles)
{}
No comments:
Post a Comment