ARTICLE

Get File Last Write Time in C#

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

The SetLastWriteTime and GetLastWriteTime methods are used to set and get the last write date and time of the specified file. The following code snippet sets and gets the last write date and time of a file.

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

COMMENT USING
Employers - Post Free Jobs