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

Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 670
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));


Comments or Responses

Login to post response