I am looking for ideas or a syntax to search through a folder header to find the most recent build for production.
example of folder header:
c:\program files\company\updates
1.1.3.0.102
1.1.3.0.103 //this being the most recent
Thanks in advance!
Loading

VulpesRank #55 · 29.2K reputationPosted Jan 5, 2015, 6:17 AM EST
using System;
using System.IO;
using System.Linq;
class Program
{
static void Main()
{
string parentPath = @"c:\program files\updates";
var parent = new DirectoryInfo(parentPath);
string latest = parent.GetDirectories().OrderBy(di => di.CreationTime).Last().Name;
Console.WriteLine(latest);
Console.Readkey();
}
}
VulpesRank #55 · 29.2K reputationPosted Jan 5, 2015, 9:53 AM EST
Try this instead:
Marc176 reputationPosted Jan 5, 2015, 6:24 AM EST
Marc176 reputationPosted Jan 5, 2015, 8:30 AM EST
What I've added to your code and changed parent and child folder names:
var theCurrentRelease = new DirectoryInfor(currentRelease);
var curPackage = theCurrentRelease.GetFIles("Package.exe");
File.Copy(curPackage.ToString(), @"C:\Desktop\Practice");
Problem i'm getting is the pathway cannot be found. Any Idea? or is my syntax completely off?