[C#] How to Get and Set File Creation Time

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);

 

Xem thêm  [C#] How to use Dictionary Properties and Methods in C#

1 Response

  1. Free Stuff says:

    I am constantly searching online for articles that can benefit me. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *