using System;
using System.IO;
class Test
{
public static void Main()
{
string path = @"c:\MyDir";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
else
{
// Take an action which will affect the write time.
Directory.SetLastWriteTime(path, new DateTime(1985,4,3));
}
// Get the creation time of a well-known directory.
DateTime dt = Directory.GetLastWriteTime(path);
Console.WriteLine("The last write time for this directory was {0}", dt);
// Update the last write time.
Directory.SetLastWriteTime(path, DateTime.Now);
dt = Directory.GetLastWriteTime(path);
Console.WriteLine("The last write time for this directory was {0}", dt);
}
}