static void Main(string[] args) { DateTime fileCreatedDate = File.GetCreationTime(@"C:\Example\MyTest.txt"); Console.WriteLine("file created: " + fileCreatedDate); }
System.IO.File.GetCreationTime()
public static string ReadLastFile(string dirPath) { if (!Directory.Exists(dirPath)) throw new FileNotFoundException(); var lastFilePath = Directory.GetFiles(dirPath).OrderBy(f => new FileInfo(f).CreationTime).Last(); return File.ReadAllText(lastFilePath); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)