My folder contain more then 100 zip files. I want to select random 6 zip file from a folder.
I try:
DirectoryInfo test = new DirectoryInfo(@ "C:\test").GetFiles();
foreach(FileInfo file in test.GetFiles()) {
Random R = new Random(); //try to apply random logic but fail.
if (file.Extension == ".zip") {
string a = "";
for (int ListTemplate = 0; ListTemplate < 6; ListTemplate++) {
a += file.FullName; //Want to choose random 6 files.
}
}
}
Is there any way to do this.