To get creation and last access time for directory or folder in c#

Jitendrasoft09
Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 659
using System;
using System.IO;

class JkExample {

static void Main(string[] args) {

string[] fileNames = Directory.GetFiles(@"C:\");

foreach (string name in fileNames) {

Console.WriteLine("File name: {0}", name);
Console.WriteLine("Created: {0}", Directory.GetCreationTime(name));
Console.WriteLine("Accessed: {0}", Directory.GetLastAccessTime(name));


Console.ReadLine();
}
}

Comments or Responses

Login to post response