Search code examples
c#ntfswindows-explorer

How can we modify the date of folder in file explorer


Is there a way with which we can modify the date of folder in file explorer or is this a part of Ntfs architecture which can't be changed. Assuming there is no NTFS restriction; how can I change the creation time of a folder using c#


Solution

  • Excerpt from the MSDN in the comments

    string n = @"C:\test\dirToChange";
    //Create two variables to use to set the time.
    DateTime dtime1 = new DateTime(2002, 1, 3);
    
    //Set the creation time to a variable DateTime value.
    Directory.SetCreationTime(n, dtime1);