var filesDictionary = new Dictionary<string, long>();
var filesList = System.IO.Directory.GetFiles(project.Variables["folderPath"].Value);
foreach (var file in filesList)
{
filesDictionary[file] = new System.IO.FileInfo(file).Length;
}
var sortedFilesDictionary = from entry in filesDictionary orderby entry.Value descending select entry;
var largestFilesDictionary = sortedFilesDictionary.Take(5);
foreach (var pair in largestFilesDictionary)
{
project.Lists["largestFiles"].Add(pair.Key);
}