How to get File Created Date and Modified Date [duplicate]
Solution 1:
You could use below code:
DateTime creation = File.GetCreationTime(@"C:\test.txt");
DateTime modification = File.GetLastWriteTime(@"C:\test.txt");
Solution 2:
You can do that using FileInfo
class:
FileInfo fi = new FileInfo("path");
var created = fi.CreationTime;
var lastmodified = fi.LastWriteTime;
Solution 3:
File.GetLastWriteTime
to Get last modified
File.CreationTime
to get Created time