The Directory.SetCreationTime and Directory.GetCreationTime methods are used to set and get the creation date and time of the specified directory. The following code snippet sets and gets the creation time of a directory.
string root = @"C:Temp"; // Get and Set Creation time Directory.SetCreationTime(root, DateTime.Now); DateTime creationTime = Directory.GetCreationTime(root); Console.WriteLine(creationTime);