i try to get time of file. scanerio is when any last file is create/modified in folder i want that file date time in console
i try this
but this shows error
Access to the path 'C:\Users\Administrator\Desktop\New folder' is denied.
any solution
public static void Main()
{
try
{
string path = @"C:\Users\Administrator\Desktop\New folder;
if(!File.Exists(path))
{
File.Create(path);
}
DateTime dt = File.GetLastWriteTime(path);
Console.WriteLine("the last time {0}", dt);
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}