How to get File Created Date and Modified Date

griffithstratton picture griffithstratton · Apr 23, 2014 · Viewed 131.3k times · Source

I have an .NET EXE file . I want to find the file created date and modified date in C# application. Can do it through reflection or with IO stream?

Answer

waitefudge picture waitefudge · Apr 23, 2014

You could use below code:

DateTime creation = File.GetCreationTime(@"C:\test.txt");
DateTime modification = File.GetLastWriteTime(@"C:\test.txt");