ARTICLE

Set File Creation Time in C#

Posted by Dinesh Beniwal Articles | Files, Directory, IO August 14, 2012
In this article we will discuss about how to Set File Creation Time in C#.
Reader Level:

The SetLastAccessTime and GetLastAccessTime methods are used to set and get the last access date and time of the specified file. The following code snippet sets and gets the last access date and time of a file.

// Get and set file last access time
string
fileName = @"c:\temp\Mahesh.txt";
File
.SetLastAccessTime(fileName, DateTime.Now);
DateTime
dt = File.GetLastAccessTime(fileName);
Console
.WriteLine("File last access time: {0}", dt.ToString());

Login to add your contents and source code to this article
comments
COMMENT USING
PREMIUM SPONSORS
Infragistics is experts in technology and design, and passionate about helping you build highly performant and stylish applications that solve problems, deliver inspiration, and maximize results.
SPONSORED BY
Nevron Diagram