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
VulpesPosted Jan 5, 2015, 11:17 AM
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();
}
}
VulpesPosted Jan 5, 2015, 2:53 PM
Try this instead:
MarcPosted Jan 5, 2015, 1:30 PM
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?
MarcPosted Jan 5, 2015, 11:24 AM